public void Create(FeedbackInputModel model) { var feedback = new Feedback() { Title = model.Title, SenderEmail = model.SenderEmail, Content = model.Content, Type = (FeedbackType)model.Type }; this.Feedbacks.Add(feedback); this.Feedbacks.SaveChanges(); }
public ActionResult Feedbacks_Destroy([DataSourceRequest]DataSourceRequest request, Feedback feedback) { if (ModelState.IsValid) { var entity = new Feedback { Id = feedback.Id, SenderEmail = feedback.SenderEmail, Title = feedback.Title, Content = feedback.Content, Type = feedback.Type }; db.Feedbacks.Attach(entity); db.Feedbacks.Remove(entity); db.SaveChanges(); } return Json(new[] { feedback }.ToDataSourceResult(request, ModelState)); }
public void Delete(Feedback entity) { this.Feedbacks.Delete(entity); this.Feedbacks.SaveChanges(); }