Open Closed

routing #6689


User avatar
0
nabass created

i hope i can explain my big problem hi sir, i am trying to do update method in a composite key class here is my steps with some attachment: hope you can help me 1- created class (createUpdateDto) 2- put my key into it 3- create an interface 4- create service 5- create controller (i know abp gives me auto controller but i should do it because i have more than module)

i faced problem when trying to update in swagger (error 400) The value '{documentStatusId}' is not valid for DocumentStatusId. i cached the problem in routing he says unused route parameter like image below so i fixed it inject int documentStatuesId and string cultureId and error is gone but interface says i must generate method exactly right my interface see picture and you will understand me thank

  • ABP Framework version: v8
  • UI Type:MVC
  • Database System: EF Core (SQL Server)

15 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    How does a documentStatusId represent a class with two parameters? I don't think it's possible by default.

    See https://learn.microsoft.com/en-us/aspnet/core/fundamentals/routing?view=aspnetcore-8.0 https://learn.microsoft.com/en-us/aspnet/core/fundamentals/routing?view=aspnetcore-8.0#custom-route-constraints

  • User Avatar
    0
    nabass created

    It's a composite key Did you mean i must delete it from route ?? If i delete it it still have an unused route with Culture Id

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You can consider using single parameters.

    eg:

    appservice

    UpdateAsync(int documentStatusId, string cultureld, CreateUpdateDocumentStatusCultureDto input)
    

    contoller

    [HttpPut]
    [Route("{documentStatusId}/{cultureld}")]
    UpdateAsync(int documentStatusId, string cultureld, CreateUpdateDocumentStatusCultureDto input)
    
  • User Avatar
    0
    nabass created

    Hi Thanks for responding But i already did it in the last 2 imgs and have an error implementing interface

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    You need to change the interface and implementation of the application service

  • User Avatar
    0
    nabass created

    hi sir, i did what you said

    • img 1 is controller
    • img 2 is app service
    • img 3 is interface but i have this error

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you share a test project? liming.ma@volosoft.com

  • User Avatar
    0
    nabass created

    check your mail thank you

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you try to remove the IDocumentStatusCultureAppService from DocumentStatusCultureAppService methods.

    If you can share a complete project, I will debug it to check the problem.

  • User Avatar
    0
    nabass created

    How will i remove the interface ?? All methods into it and controller will not work. All the project is alote of models i just have problem with code i shared all pages are working good This culture get and create are also working good My problem with update and download excel If i removed the interface you mentioned i will face a problem with the interface in application.cotract project

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you share a complete project, I will debug it to check the problem.

    liming.ma@volosoft.com

  • User Avatar
    0
    nabass created

    Hi sir I already sent you the project with mapping and entityframe work every thing Just make (abp new test) And put files i shared

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you share a project that I can build and test?

    Thanks.

  • User Avatar
    0
    nabass created

    Hi sir I tried to share but i couldn't It's a lot of files with azure connection with multiple model and projects and it's more than 2GB So i tried to give you the best way to help me with sharing files and source code that i have problem with and explain exactly what i did and what i faced and what the steps and all what i did I hope to help me or kindly tell me you don't have the solution Thanks your effort

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you reproduce your problem in a new template project?

    Thanks

Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09