What's Wrong - .NET Practical Interview Question #9

  Рет қаралды 3,043

DotNetMastery

DotNetMastery

Күн бұрын

Пікірлер: 12
@pilotboba
@pilotboba Жыл бұрын
I've never seen an update coded this way. You do check in the id passed in the Url is the same as that passed in the payload, which is good. You don't do any null checking after line 80, so if that id isn't in the db, you will get a null reference error. The common way I see this done it more along the lines of: Check IsValid and return View() if it's not. Do the db query. Check if the result is null, if so, return a notfound or redirect to a not found page. Update the object retrieved from the db and save changes. But, these days, I also prefer task based UI. Rather than sending the full entity from the client, send an UpdateDescription command so it's clear the users intent.
@rahulawasthi886
@rahulawasthi886 Жыл бұрын
3 weeks gone. No new video. We are waiting.....
@komando005
@komando005 Жыл бұрын
Thanks for your effort your videos are really good keep going brother 💪
@DotNetMastery
@DotNetMastery Жыл бұрын
thank you so much!
@ranaabushammalh2152
@ranaabushammalh2152 Жыл бұрын
Can you extend the special offer on this course RESTful Web API - The Complete Guide (.NET7 API) Part 1 in Udemy ...for two days because I wanted to buy it but was not able to buy it in the previous days. Please, I have bought .NET Core MVC - The Complete Guide 2023 course:(((
@vikasrajput6135
@vikasrajput6135 Жыл бұрын
Thanks much
@JamesYGGoY
@JamesYGGoY Жыл бұрын
Can you give a little more detail into why you would want your entity not tracked by your context?
@DotNetMastery
@DotNetMastery Жыл бұрын
Because in the Update we are passing an entity. at that time EF will add a tracker on that entity based on the primary key buy if you are already tracking because of first or default, EF cannot track same entity again.
@JamesYGGoY
@JamesYGGoY Жыл бұрын
@@DotNetMastery so, it's because of the Edit it seems. I was thinking of a scenario where the record we have in the database is legitimately different, but by random chance, the Id's matched, in which case, we wouldn't want to overwrite - but my scenario is a create scenario now that I think more on it. Thanks! I'm enjoying this series, keep it up!
@JohnnyBravo-ju7tt
@JohnnyBravo-ju7tt Жыл бұрын
Thanks !!!
@DotNetMastery
@DotNetMastery Жыл бұрын
You're welcome!
What's Wrong - .NET Practical Interview Questions
3:09
DotNetMastery
Рет қаралды 2,5 М.
What's New in .NET 9 with Examples
25:02
Nick Chapsas
Рет қаралды 65 М.
Маусымашар-2023 / Гала-концерт / АТУ қоштасу
1:27:35
Jaidarman OFFICIAL / JCI
Рет қаралды 390 М.
Ozoda - Alamlar (Official Video 2023)
6:22
Ozoda Official
Рет қаралды 10 МЛН
Jaidarman TOP / Жоғары лига-2023 / Жекпе-жек 1-ТУР / 1-топ
1:30:54
Coding Interview | Software Engineer @ Bloomberg (Part 1)
30:05
Keep On Coding
Рет қаралды 4,8 МЛН
Clean Architecture with NET 8
54:38
NimblePros
Рет қаралды 4,9 М.
C# multithreading 🧶
6:59
Bro Code
Рет қаралды 166 М.
Abstraction Can Make Your Code Worse
5:13
CodeAesthetic
Рет қаралды 676 М.
Authentication vs Authorization - What's the difference?
4:37
DotNetMastery
Рет қаралды 5 М.
Coding Shorts: ASP.NET Core Middleware Explained
17:36
Shawn Wildermuth
Рет қаралды 32 М.
ASMR Programming - Spinning Cube - No Talking
20:45
Servet Gulnaroglu
Рет қаралды 4,3 МЛН
The weirdest way to loop in C# is also the fastest
12:55
Nick Chapsas
Рет қаралды 254 М.