public void Update(StatisticsEntry entry) { using (var context = new MillionaireContext()) { var question = context.Questions.Where(q => q.QuestionID == entry.QuestionID) .Include(q => q.Answers).FirstOrDefault(); int i = 0; foreach (var child in question.Answers) { context.Entry(child).Entity.TimesSelected = entry.Question.Answers[i++].TimesSelected; context.Entry(child).State = EntityState.Modified; } context.SaveChanges(); } }
public void Delete(StatisticsEntry entry) { using (var context = new MillionaireContext()) { context.Entry(entry).State = EntityState.Deleted; } }
public void Delete(User user) { using (var context = new MillionaireContext()) { context.Entry(user).State = EntityState.Deleted; } }