public void Activate(int id) { using (var context = new IdeaPoolEntities()) { IdeaStatus status = Get(context, id); status.IsActive = true; Update(context, status); } }
public bool UpdateStatus(int ideaId, int statusId, int userId) { bool isUpdate = false; using (var context = new IdeaPoolEntities()) { Idea idea = context.Ideas.SingleOrDefault(x => x.Id == ideaId); IdeaStatus status = context.IdeaStatus.SingleOrDefault(x => x.Id == statusId); if (idea != null && status != null) { idea.IdeaStatus = status; context.Entry(idea).State = EntityState.Modified; InsertIdeaHistory(context, ideaId, userId, ActivityKeys.UPDATE_IDEA_STATUS, status.Status); context.SaveChanges(); isUpdate = true; } } return(isUpdate); }
private void Update(IdeaPoolEntities context, IdeaStatus status) { context.Entry(status).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); }