ASP.NET Core Web API .NET 8 2024 - 14. 1-To-Many CREATE (Post)

Поделиться
HTML-код
  • Опубликовано: 8 сен 2024
  • ASP.NET Core Web API .NET 8 2024 - 14. 1-To-Many CREATE (Post)
    Github for this repo: github.com/ted...
    Twitter: / teddysmithdev
    Github: github.com/ted...
    Linkedin: / teddy-smith-015ba61a3

Комментарии • 16

  • @tarekabiramia913
    @tarekabiramia913 7 месяцев назад +2

    One of the best Tutorials I've ever watched
    Keep it up 🔥

  • @marceloleoncaceres6826
    @marceloleoncaceres6826 7 месяцев назад

    Another great video, thanks for the tutorial

  • @abuaqeel292
    @abuaqeel292 8 дней назад

    thanks bro

  • @mouadbelbey6984
    @mouadbelbey6984 3 месяца назад +3

    Guys just for information maybe it will help someone. Don't name your controller methods with word "Async" or you will get error 500 no route matches when you will try to use CreatedAtAction on this method.

    • @MM-nj4im
      @MM-nj4im 2 месяца назад

      Thanks! I wondered why this error keeps showing

    • @AlexRonai
      @AlexRonai 2 месяца назад

      I just got that error but I'm not sure I understood your solution. You mean that this Create method shouldn't be made async?

    • @MM-nj4im
      @MM-nj4im Месяц назад

      @@AlexRonai The name of function should not end with Async I think

    • @AlexRonai
      @AlexRonai Месяц назад

      @@MM-nj4im Weird then because I renamed CreateAsync to Create and still got the error

    • @sharathkumarhk4260
      @sharathkumarhk4260 Месяц назад

      ​@@AlexRonai Sometimes cleaning the existing build and rebuilding helps. "dotnet clean" and the "dotnet watch run" or "dotnet build" "dotnet run"

  • @sigitaskublickas906
    @sigitaskublickas906 7 месяцев назад +2

    Why you didn`t add [FromBody] before CreateCommentDto commentDto? From where then comes the data to create a new comment?

    • @sigitaskublickas906
      @sigitaskublickas906 7 месяцев назад

      Or maybe i don`t understand how it works

    • @salar1997
      @salar1997 6 месяцев назад +6

      its not mandatory to use them, because .net core automatically know it, but it can simplify the process of transferring data between client-side requests and server-side code, it reduces complexity and can help other developers read your code, so better documentation.

  • @snimer3008
    @snimer3008 4 месяца назад

    why do we pass the “stockId” separately from the “createCommentDto” object, why can't we just pass everything with one object?

    • @lenhatminhkhoi9174
      @lenhatminhkhoi9174 3 месяца назад

      Did you mean combining those to only one object then parsing to the Method? I think it will make us more confused when handling with a combination object.

  • @darlissonlimeira2793
    @darlissonlimeira2793 28 дней назад

    why addasync instead of add?