public bool UpdateProject(Project project) { using (var db = new ActiveCitizenContext()) { db.Entry(db.Project.Find(project.Id)).CurrentValues.SetValues(project); return(db.SaveChanges() > 0); } }
public bool EditUserProfile(Users user) { using (var db = new ActiveCitizenContext()) { db.Entry(db.Users.Find(user.Id)).CurrentValues.SetValues(user); return(db.SaveChanges() > 0); } }
public bool UpdateDirection(ProjectDirection direction) { using (var db = new ActiveCitizenContext()) { db.Entry(db.ProjectDirection.Find(direction.Id)).CurrentValues.SetValues(direction); return(db.SaveChanges() > 0); } }
public bool EditNews(News news) { using (var db = new ActiveCitizenContext()) { db.Entry(db.News.Find(news.Id)).CurrentValues.SetValues(news); return(db.SaveChanges() > 0); } }
public bool UpdateIdea(DirectionIdea idea) { using (var db = new ActiveCitizenContext()) { db.Entry(db.DirectionIdea.Find(idea.Id)).CurrentValues.SetValues(idea); //if (idea.Status == 1) //{ // db.ProjectDirection.Find(idea.DirectionId).CountOfIdeas++; // return db.SaveChanges() > 1; //} return(db.SaveChanges() > 0); } }