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