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