コード例 #1
0
        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();
        }
コード例 #2
0
        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));
        }
コード例 #3
0
 public void Delete(Feedback entity)
 {
     this.Feedbacks.Delete(entity);
     this.Feedbacks.SaveChanges();
 }