optimization mvc code
Posted
by user276640
on Stack Overflow
See other posts from Stack Overflow
or by user276640
Published on 2010-03-13T16:51:41Z
Indexed on
2010/03/13
16:55 UTC
Read the original article
Hit count: 352
optimization
|asp.net-mvc
i have such code
var prj = _dataContext.Project.FirstOrDefault(p => p.isPopular == true);
if (prj != null)
{
prj.isPopular = false;
_dataContext.SaveChanges();
}
prj = Details(id);
prj.isPopular = true;
_dataContext.SaveChanges();
idea-i have only one record with value true in field isPopular, so i get it and make false, then i get object by id and make it isPopular true. i don't like 2 calls on savechanges. any ideas?
© Stack Overflow or respective owner