public JsonResult SaveVendorFeedback(VendorFeedback feedback) { DateTime Now = DateTime.Now; string UserName = System.Web.HttpContext.Current.User.Identity.Name; var result = false; if (ModelState.IsValid) { using (this.UoW) { if (feedback.VendorFeedbackID == Guid.Empty) { feedback.InputDate = Now; feedback.InputBy = UserName; feedback.VendorFeedbackID = Guid.NewGuid(); this.UoW.VendorFeedbacks.Insert(feedback); result = this.UoW.Commit() > 0; } else { feedback.LastModifiedBy = UserName; feedback.LastModifiedDate = Now; this.UoW.VendorFeedbacks.Update(feedback); result = this.UoW.Commit() > 0; } } return Json(new { Success = result }); } else { return Json(new { Success = result, Message = "Invalid Model" }); } }
public JsonResult DeleteVendorFeedback(VendorFeedback feedback) { bool result = false; using (this.UoW) { this.UoW.VendorFeedbacks.Delete(feedback); result = this.UoW.Commit() > 0; } return Json(new { Success = result }); }