ASP.NET Core Web API .NET 8 2024 - 7. PUT (Update)
Вставка
- Опубліковано 6 січ 2024
- ASP.NET Core Web API .NET 8 2024 - 7. PUT (Update)
Github repo for course: github.com/teddysmithdev/FinS...
Twitter: / teddysmithdev
Github: github.com/teddysmithdev
Linkedin: / teddy-smith-015ba61a3 - Навчання та стиль
Another approach would be to use: _ctx.Entry(entity).CurrentValues.SetValues(dto); instead of manual mapping :) Thanks for your effort on this series!
just found out about this. sweet!
Why it's like you are trying to create a template of entity mapping if am confused
Killing it as always man 🔥🔥
keep going
Fascinating
We are good to go!
why we can't use _context.Stock.update()?
Why dont you use a dto to model mapper for update like what you did with create? Is it just because AddAsync() not accept DTO models?
Pretty much yeah lol
How about EF method AddOrUpdate? It significantly reduces code where you can just put entity Id into the body's DTO and solve both add/update operations in one line (if mapping is not required). But, of course, in this particular case it should be only one POST AddOrUpdate method, which is not bad, in my opinion. What do you think?
(opinion) Will work great for small project but will become a pain as app grows bigger and you have to do little logic checks on data coming in. But you may create something cool so don't let me stop you lol
@@TeddySmithDev Can you angular as well