ASP.NET Core Web API - 9. POST & Create Methods [PART 1]

Поділитися
Вставка
  • Опубліковано 9 січ 2025

КОМЕНТАРІ • 42

  • @seetheious9879
    @seetheious9879 2 роки тому +15

    Big props, most videos limit themselves to low hanging fruit with simple datamodels for short presentation. You did it properly step by step with many to many join tables, repositories and DTO's. Thank you.

  • @Mooseontheloose89
    @Mooseontheloose89 Рік тому +9

    Another good video, when creating the new mappings, you don't need to type out both sets of CreateMap(); & CreateMap();
    You can just add .ReverseMap(); onto the end so that it maps both ways so with the previous example: CreateMap().ReverseMap(); 🦌

  • @xmateosx
    @xmateosx Рік тому +5

    This video is missing from your Play List
    Love learning from you!

  • @jeffwoltjen3887
    @jeffwoltjen3887 Рік тому +4

    Thank you so much for taking the time to debug the issue on the stream. As a learner, it is so important for me to watch how this is done, so thank you so much for doing that!

  • @lucash.o.koyama4466
    @lucash.o.koyama4466 Рік тому +3

    Great lectures, terrific job! I would just suggest to change the video order in the playlist, the part 1 comes after the part 2 of the POST Methods.

  • @АндрейГорохов-ы9ю
    @АндрейГорохов-ы9ю 2 роки тому +10

    It was possible to use: CreateMap().ReverseMap();

  • @GrowmieTilman
    @GrowmieTilman Рік тому +1

    The last part was a little hard to understand. But you created a brilliant video, again :)

  • @beast714mode
    @beast714mode 2 роки тому

    Thanks so much for this video series. Really helped me a lot!

  • @mattmsmith
    @mattmsmith 7 місяців тому

    You never responded to my previous comment. That would have been helpful but aside from that. I have learned more in this series, solidifying my knowledge than my formal education. I am about to graduate with a software engineering degree in September and this goes to show UA-cam is the biggest university. I am paying it forward by liking each video, and plan to check out your Unit Testing course. I hope that course will help with debugging API's. Debugging is my weak point.

    • @TeddySmithDev
      @TeddySmithDev  7 місяців тому +1

      Thanks for comments and likes Matt (cool last name btw lol). Good luck with graduation 👍

  • @hoangphuc1072
    @hoangphuc1072 2 роки тому

    Thanks sir so much for this very helpful video

  • @nabiljebokji4213
    @nabiljebokji4213 2 роки тому

    thank you for doing these kind of videos you are the best ;

  • @jenishpokhrel7121
    @jenishpokhrel7121 11 місяців тому +1

    While creating the owner I didn't get any errors. I didn't have to add the country Id it just created the owner without extending the ICountryRepository in the ownercontroller. I know that's not right. How do I solve that issue? Your code and mine is exact same

  • @elchinmirzayev7631
    @elchinmirzayev7631 7 місяців тому

    thanks for eyerything, it's was really helpful for me, i just want to learn for category post method you write for mapping Category and in Helper from CategoryDto to Category, here is my question why we just don't write CategoryDto instead of Category?

  • @mugac9202
    @mugac9202 9 місяців тому +2

    This video on the wrong queue in your playlist

    • @TeddySmithDev
      @TeddySmithDev  9 місяців тому

      Long story about video in wrong order. This video playlist is pretty old so when I go back to try and change order, it won’t allow me too. Which is weird because I can on newer vids. I’m trying to contact someone at UA-cam about it to see if they can change it for me.

  • @neelkamal7454
    @neelkamal7454 Рік тому +2

    While creating data...
    do we need to mention the name of table like,
    context.Category.Add(create category)
    How will entityframework know in which table to add data.

    • @sdscode
      @sdscode Рік тому +1

      I have the exact same question, would be great to know.

    • @bogdans9041
      @bogdans9041 Рік тому +2

      _db.Add(category);
      Entity Framework determines which table to add the data to based on default conventions. _context represents an Entity Framework data context, and EF uses information about the type of the country object passed to the Add method to understand which table to add the data to.
      In this case, if country is an instance of the Country class and you have a data context that includes a DbSet, EF will recognize that the data should be added to the table associated with the Country class. EF also uses conversion to map the properties of the Country class to columns in that table.
      Roughly speaking, he uses a reflection tool to find out what type of object was passed and then finds a mapping to the desired table

  • @rasovukicevic3190
    @rasovukicevic3190 8 місяців тому

    Is there a reason why we create a category in CategoryRepository with _context.Add(category); and not with _context.Categories.Add(Category); ? Are both ways good and is there any diference?

  • @kirillzlobin7135
    @kirillzlobin7135 10 місяців тому

    Very useful content

  • @huynguyenluonggia6393
    @huynguyenluonggia6393 Рік тому +1

    Why don't you add an attribute named "Countryid" in the Owner Model to present the relationship between Owner and Country?

    • @TeddySmithDev
      @TeddySmithDev  Рік тому +1

      You could easily do that and is actual more representative of the actual game 🤣

  • @bowfed6461
    @bowfed6461 Рік тому

    god bless these videos

  • @johanpalsson8725
    @johanpalsson8725 2 роки тому

    Love your videos. Would it be possible to demonstrate how you send a ICollection to the HttpPost request, map it with Automapper and save the ICollection in the model/database?

  • @BlinaAvdullahu
    @BlinaAvdullahu Рік тому

    my DTO "reverse" in post method is not working, do you have any idea why, is showing 400 bad request

  • @Mroosskkaarr88
    @Mroosskkaarr88 Рік тому

    hello, im trying to find your authentication and authoraziation serie, have you created it yet?
    gonna work through ur testing but really liked all your videos, i have finnished em all. Couln't find autherization or authentication.. have you implemented it yet?

    • @TeddySmithDev
      @TeddySmithDev  Рік тому +1

      I’m working on auth right now. Should be done in a few months.

  • @Mortalstefan
    @Mortalstefan 11 місяців тому

    When i try to post, i get an 404 not found?! Do anyone have similiar issue, or know how to solve this

  • @lokesamedeu471
    @lokesamedeu471 Рік тому

    In the CreateCategory action, can we use the category exists function in the catergory repository that we created in the previous videos to check if the category is already exists in the database or not ?
    There is a way to not repeat the save method definition on all the repositories ?

    • @TeddySmithDev
      @TeddySmithDev  Рік тому +1

      yeah, sounds like a good idea

    • @lokesamedeu471
      @lokesamedeu471 Рік тому

      @@TeddySmithDev Btw thank you very very much for this amazing course !

  • @ogwanighiegeorge739
    @ogwanighiegeorge739 Рік тому

    If I try putting the ID details it doesn't work
    Any reason why

  • @JeffZiegler76
    @JeffZiegler76 10 місяців тому

    FYI: Play list #9 is in the wrong order.

  • @hugnt
    @hugnt Рік тому

    Why dont you make a foreign key can be null? That may solve for the promblem?

  • @shivpratapshukl1445
    @shivpratapshukl1445 2 роки тому +1

    i did not know that tom felton is .net developer.

    • @TeddySmithDev
      @TeddySmithDev  2 роки тому +3

      lol my ex gf used to say that actually.

    • @shivpratapshukl1445
      @shivpratapshukl1445 2 роки тому

      @@TeddySmithDev love u man. it's hard finding right content.

  • @lailaalmgrbi2207
    @lailaalmgrbi2207 2 роки тому

    Hi
    Please answer my question
    How post image from asp.net web API and Reception that image from Flutter?!
    Please answer me 💔

  • @Dovmial
    @Dovmial 2 роки тому +7

    public bool Save()
    {
    return _context.SaveChanges() > 0;
    }

    • @TheAngpeu
      @TheAngpeu Рік тому

      public bool Save() => _context.SaveChanges() > 0; :))