public Operation SaveAcquisition(FxdAcquisition objFxdAcquisition) { Operation objOperation = new Operation { Success = true, Message = "Saved successfully." }; int Id = anFFixedAcquisitionRepository.AddEntity(objFxdAcquisition); objOperation.OperationId = Id; try { unitOfWork.Commit(); } catch (Exception ex) { objOperation.Success = false; objOperation.Message = "Save not successful."; } return objOperation; }
public ActionResult SaveAcquisition(FxdAcquisition fixedAssetEntry) { int companyId = Convert.ToInt32(Session["companyId"]); int userid = Convert.ToInt32(Session["userId"]); int financialYearId = Convert.ToInt32(Session["financialYear"]); decimal cost = fixedAssetEntry.AcquisitionCost; int quantity = fixedAssetEntry.Quantity; Operation objOperation = new Operation(); if (ModelState.IsValid) { if (fixedAssetEntry.Id == 0) { if ((bool)Session["Add"]) { fixedAssetEntry.SecCompanyId = companyId; fixedAssetEntry.CmnFinancialYearId = financialYearId; fixedAssetEntry.TotalAcquisitionCost = cost * quantity; //fixedAssetEntry.AnfVoucherId = 1; fixedAssetEntry.CreatedBy = userid; fixedAssetEntry.CreatedDate = DateTime.Now.Date; objOperation = _AnFFixedAssetService.SaveAcquisition(fixedAssetEntry); } else { objOperation.OperationId = -2; objOperation.Success = false; } } else { if ((bool)Session["Edit"]) { fixedAssetEntry.SecCompanyId = companyId; fixedAssetEntry.CmnFinancialYearId = financialYearId; fixedAssetEntry.TotalAcquisitionCost = cost * quantity; //fixedAssetEntry.AnfVoucherId = 1; fixedAssetEntry.ModifiedBy = userid; fixedAssetEntry.ModifiedDate = DateTime.Now.Date; //objOperation = _AnFFixedAssetService.UpdateAcquisition(fixedAssetEntry); } else { objOperation.OperationId = -2; objOperation.Success = false; } } } return Json(objOperation, JsonRequestBehavior.DenyGet); }