public Operation Delete(SlsThana obj) { Operation objOperation = new Operation { Success = true, OperationId = obj.Id }; _thanaRepository.Delete(obj); try { _UnitOfWork.Commit(); } catch (Exception) { objOperation.Success = false; } return objOperation; }
public Operation Save(SlsThana obj) { Operation objOperation = new Operation { Success = true }; long Id = _thanaRepository.AddEntity(obj); objOperation.OperationId = Id; try { _UnitOfWork.Commit(); } catch (Exception ex) { objOperation.Success = false; } return objOperation; }
public ActionResult Save(SlsThana slsThana) { int userId = Convert.ToInt32(Session["userId"]); Operation objOperation = new Operation { Success = false }; if (ModelState.IsValid) { if (slsThana.Id == 0) { if ((bool)Session["Add"]) { slsThana.CreatedBy = userId; slsThana.CreatedDate = DateTime.Now.Date; objOperation = _thanaService.Save(slsThana); } else { objOperation.OperationId = -1; } } else { if ((bool)Session["Edit"]) { slsThana.ModifiedBy = userId; slsThana.ModifiedDate = DateTime.Now.Date; objOperation = _thanaService.Update(slsThana); } else { objOperation.OperationId = -2; } } } return Json(objOperation, JsonRequestBehavior.DenyGet); }