public Operation DeleteAnFCostCenter(AnFCostCenter objAnFCostCenter) { Operation objOperation = new Operation { Success = true, OperationId = objAnFCostCenter.Id }; _AnFCostCenterRepository.Delete(objAnFCostCenter); try { _UnitOfWork.Commit(); } catch (Exception) { objOperation.Success = false; } return objOperation; }
public Operation SaveAnFCostCenter(AnFCostCenter objAnFCostCenter) { Operation objOperation = new Operation { Success=true}; long Id = _AnFCostCenterRepository.AddEntity(objAnFCostCenter); objOperation.OperationId = Id; try { _UnitOfWork.Commit(); } catch (Exception ex) { objOperation.Success = false; } return objOperation; }
public ActionResult SaveCostCenter(AnFCostCenter anFCostCenter) { Operation objOperation = new Operation { Success = false }; if (ModelState.IsValid) { if (anFCostCenter.Id == 0) { if ((bool)Session["Add"]) { anFCostCenter.CmnCompanyId = Convert.ToInt32(Session["companyId"].ToString()); objOperation = _ccService.SaveAnFCostCenter(anFCostCenter); } else { objOperation.OperationId = -1; } } else { if ((bool)Session["Edit"]) { anFCostCenter.CmnCompanyId = Convert.ToInt32(Session["companyId"].ToString()); objOperation = _ccService.UpdateAnFCostCenter(anFCostCenter); } else { objOperation.OperationId = -2; } } } return Json(objOperation, JsonRequestBehavior.DenyGet); }