private ResultDto InsertUpdate(FundSourceDto fundsource) { ResultDto resultDto = new ResultDto(); string obectName = "fundsource"; try { ObjectParameter prmFundSourceID = new ObjectParameter("FundSourceID", fundsource.FundSourceID); ObjectParameter prmFundSourceCode = new ObjectParameter("FundSourceCode", string.Empty); int effectedCount = _dbContext.uspFundSourceInsertUpdate(prmFundSourceID, fundsource.FundSourceName, fundsource.TEFundSourseName, fundsource.UserId, prmFundSourceCode); resultDto.ObjectId = (int)prmFundSourceID.Value; resultDto.ObjectCode = string.IsNullOrEmpty((string)prmFundSourceCode.Value) ? fundsource.FundSourceCode : (string)prmFundSourceCode.Value; if (resultDto.ObjectId > 0) { resultDto.Message = string.Format("{0} details saved successfully with code : {1}", obectName, resultDto.ObjectCode); } else if (resultDto.ObjectId == -1) { resultDto.Message = string.Format("Error occured while generating {0} code", obectName); } else { resultDto.Message = string.Format("Error occured while saving {0} details", obectName); } } catch (Exception) { resultDto.Message = string.Format("Service layer error occured while saving the {0} details", obectName); resultDto.ObjectId = -98; } return(resultDto); }
public FundSourceDto GetByID(int fundsourceID) { List <uspFundSourceGetByFundSourceId_Result> lstuspfundsourceGetByFundsourceId_result = _dbContext.uspFundSourceGetByFundSourceId(fundsourceID).ToList(); FundSourceDto fundsourceDto = Mapper.Map <uspFundSourceGetByFundSourceId_Result, FundSourceDto>(lstuspfundsourceGetByFundsourceId_result.FirstOrDefault()); return(fundsourceDto); }
public ActionResult CreateFundSource(string Id) { int fundSourceId = DecryptQueryString(Id); var fundSourceDto = new FundSourceDto(); var objFundsourceModel = new FundSourceModel(); if (fundSourceId > 0) { fundSourceDto = _fundSourceService.GetByID(fundSourceId); objFundsourceModel = Mapper.Map <FundSourceDto, FundSourceModel>(fundSourceDto); } ViewBag.Result = new ResultDto(); return(View(objFundsourceModel)); }
public ResultDto Update(FundSourceDto fundsource) { return(InsertUpdate(fundsource)); }