public ActionResult Create() { MainApplication model = new MainApplication() { CommissionMasterDetails = new CommissionMaster() }; var details = _CommissionService.GetLast(); int lastid = 0; int length = 0; if (details != null) { lastid = details.CommissionId; lastid = lastid + 1; length = lastid.ToString().Length; } else { lastid = 1; length = 1; } string commcode = _utilityService.getName("CMS", length, lastid); model.CommissionMasterDetails.CommissionCode = commcode; TempData["commissioncode"] = commcode; model.userCredentialList = _IUserCredentialService.GetUserCredentialsByEmail(UserEmail); model.modulelist = _iIModuleService.getAllModules(); model.CompanyCode = CompanyCode; model.CompanyName = CompanyName; model.FinancialYear = FinancialYear; model.EmpList = _EmployeeService.GetEmployeeListBySalesAndTarget(); model.UnitList = _UnitService.getallsize(); model.ItemSubCategoryList = _ItemSubCategoryService.GetItemSubCategories(); return(View(model)); }