public Operation Delete(AnFMonthLock objAnFMonthLock) { Operation objOperation = new Operation { Success = true, Message = "Deleted successfully." }; anFMonthLockRepository.Delete(objAnFMonthLock); try { unitOfWork.Commit(); } catch (Exception) { objOperation.Success = false; objOperation.Message = "Delete not successful."; } return objOperation; }
public Operation Save(AnFMonthLock objAnFMonthLock) { Operation objOperation = new Operation { Success = true, Message = "Saved successfully." }; long Id = anFMonthLockRepository.AddEntity(objAnFMonthLock); objOperation.OperationId = Id; try { unitOfWork.Commit(); } catch (Exception ex) { objOperation.Success = false; objOperation.Message = "Save not successful."; } return objOperation; }
// Save Method public ActionResult Save(AnFMonthLock monthLock) { int companyId = Convert.ToInt32(Session["companyId"]); int userid = Convert.ToInt32(Session["userId"]); int financialYearId = Convert.ToInt32(Session["financialYear"]); monthLock.CmnFinancialYearId = financialYearId; Operation objOperation = new Operation(); if(ModelState.IsValid) { if(monthLock.Id == 0) { if((bool)Session["Add"]) { monthLock.SecConpanyId = companyId; monthLock.CreatedBy = userid; monthLock.CreatedDate = DateTime.Now.Date; objOperation = _AnFMonthLockService.Save(monthLock); } else { objOperation.OperationId = -2; objOperation.Success = false; } } else { if((bool)Session["Edit"]) { monthLock.SecConpanyId = companyId; monthLock.ModifiedBy = userid; monthLock.ModifiedDate = DateTime.Now.Date; objOperation = _AnFMonthLockService.Update(monthLock); } else { objOperation.OperationId = -2; objOperation.Success = false; } } } return Json(objOperation, JsonRequestBehavior.DenyGet); }
public Operation Update(AnFMonthLock objAnFMonthLock) { Operation operation = new Operation { Success = true }; anFMonthLockRepository.Update(objAnFMonthLock); try { unitOfWork.Commit(); } catch (Exception) { operation.Success = false; } return operation; }