News for hackers. Stuff that matters.
Re:A todo list for new ASP.NET Core projects by midasz on Thursday February 08, 2018 @03:06AM (#16330871)
How about adding a "GetByID" function? The check is searching the entity, if NULL - save - if NOT NULL - update.

I don't believe it is useful to save a trip to the database, the database is there for a reason.

Re:A todo list for new ASP.NET Core projects by biarity on Thursday February 08, 2018 @03:14AM (#16330891)
Yes, that is the usual way of doing it. However, the point of this post was to showcase some ways of reducing duplicate code in large projects. Doing it normally (by checking if the entity already exists) can get repetitive if you have many controllers/entities. If you know of a better way of doing this, I'd be happy to update my article :)