public async Task <ActionResult> Create(EmployeeModel emp) { if (emp.EMPPhoto1 != null) { emp.EMPPhoto = SaveImageFile(emp.EMPPhoto1, "DP"); } if (emp.ConAdhaarNumberFilePath != null) { emp.ConAdhaarFileName = SaveImageFile(emp.ConAdhaarNumberFilePath, "ADHRS"); } if (emp.ConVoterIdFilePath != null) { emp.ConVoterIdFileName = SaveImageFile(emp.ConVoterIdFilePath, "VoterIds"); } if (emp.ConPanNumberFilePath != null) { emp.ConPanFileName = SaveImageFile(emp.ConPanNumberFilePath, "PANCards"); } emp.DeginationList = new SelectList(await CommonModel.GetDesignations(), "Value", "Text"); emp.DepartmentList = new SelectList(await CommonModel.GetDepartments(), "Value", "Text"); emp.ProviderList = new SelectList(await CommonModel.GetServiceProviders(CurrentUser.CompanyId), "Name", "Text"); emp.AddressTypelist = new SelectList(await CommonModel.GetLookup("ADDRESS"), "Value", "Text"); emp.CountryList = new SelectList(drop.BindCountry(), "Value", "Text"); emp.CityList = new SelectList(Enumerable.Empty <SelectList>()); emp.StateList = new SelectList(Enumerable.Empty <SelectList>()); emp.CenterList = new SelectList(Enumerable.Empty <SelectList>()); emp.Vehicle.VehicleTypeList = new SelectList(await CommonModel.GetLookup("Vehicle"), "Value", "Text"); emp.EngineerTypeList = new SelectList(await CommonModel.GetLookup("Engineer Type"), "Value", "Text"); emp.EventAction = 'I'; emp.UserId = CurrentUser.UserId; emp.CompanyId = CurrentUser.CompanyId; var pwd = CommonModel.RandomPassword(8); if (emp.IsUser) { emp.Password = Encrypt_Decript_Code.encrypt_decrypt.Encrypt(pwd, true); } if (CurrentUser.UserTypeName.ToLower().Contains("provider")) { if (!CurrentUser.UserRole.Contains("Service Provider SC Admin")) { emp.CenterList = new SelectList(await CommonModel.GetServiceCenters(CurrentUser.RefKey), "Name", "Text"); } } var response = await _employee.AddUpdateDeleteEmployee(emp); if (response.IsSuccess) { if (emp.IsUser) { var Templates = await _templateRepo.GetTemplateByActionName("User Registration", CurrentUser.CompanyId); CurrentUser.Email = emp.ConEmailAddress; var WildCards = CommonModel.GetWildCards(CurrentUser.CompanyId); var U = WildCards.Where(x => x.Text.ToUpper() == "NAME").FirstOrDefault(); U.Val = emp.ConFirstName; U = WildCards.Where(x => x.Text.ToUpper() == "PASSWORD").FirstOrDefault(); U.Val = pwd; U = WildCards.Where(x => x.Text.ToUpper() == "USER NAME").FirstOrDefault(); U.Val = emp.ConEmailAddress; CurrentUser.Mobile = emp.ConMobileNumber; var c = WildCards.Where(x => x.Val != string.Empty).ToList(); if (Templates != null) { await _emailSmsServices.Send(Templates, c, CurrentUser); } } } TempData["response"] = response; return(RedirectToAction("Index")); }