public ActionResult CreateLoanSecurityMaster(LoanSecurityMasterModel objLoanSecurityMasterModel) { var resultDto = new ResultDto(); if (ModelState.IsValid) { var loansecurityMasterDto = Mapper.Map <LoanSecurityMasterModel, LoanSecurityMasterDto>(objLoanSecurityMasterModel); loansecurityMasterDto.UserID = UserInfo.UserID; if (loansecurityMasterDto.LoanSecurityID > 0) { resultDto = _loansecurityMasterService.Update(loansecurityMasterDto); } else { resultDto = _loansecurityMasterService.Insert(loansecurityMasterDto); } if (resultDto.ObjectId > 0) { loansecurityMasterDto = _loansecurityMasterService.GetByID(resultDto.ObjectId); objLoanSecurityMasterModel = AutoMapperEntityConfiguration.Cast <LoanSecurityMasterModel>(loansecurityMasterDto); resultDto.ObjectCode = objLoanSecurityMasterModel.LoanSecurityCode; } } SelectList loansecuritymaster = GetDropDownListByMasterCode(Enums.RefMasterCodes.LOAN_SECURITY_TYPE); ViewBag.LoanSecurityMaster = loansecuritymaster; ViewBag.Result = resultDto; return(View(objLoanSecurityMasterModel)); }
public ActionResult CreateLoanSecurityMaster(string id) { int loanSecurityMasteId = string.IsNullOrEmpty(id.DecryptString()) ? default(int) : Convert.ToInt32(id.DecryptString()); SelectList loansecuritymaster = GetDropDownListByMasterCode(Enums.RefMasterCodes.LOAN_SECURITY_TYPE); ViewBag.LoanSecurityMaster = loansecuritymaster; LoanSecurityMasterDto loanSecurityMasterDto = new LoanSecurityMasterDto(); if (loanSecurityMasteId > 0) { loanSecurityMasterDto = _loansecurityMasterService.GetByID(loanSecurityMasteId); } LoanSecurityMasterModel objLoanSecurityMasterModel = Mapper.Map <LoanSecurityMasterDto, LoanSecurityMasterModel>(loanSecurityMasterDto); return(View(objLoanSecurityMasterModel)); }