public async Task<IActionResult> AddWageSchemaForProfession(AddWageSchemaForProfessionViewModel vm) { var adminServ = new AdminServices(uow); var compServ = new CompanyServices(uow); var currentUser = await GetCurrentUserAsync(); var compResult = compServ.GetCompaniesForUser(currentUser.Email); vm.Companies = CreateCompanyList(compResult.ReturnValue); vm.Professions = new SelectList(new List<SelectListItem>(), "Value", "Text"); if (ModelState.IsValid) { var result = adminServ.AddWageSchema(Convert.ToInt32( vm.SelectedProfession) , vm.Title, vm.HourlyWage ); if (result.Success) { vm.Message = result.Message; return View(vm); } ModelState.AddModelError(string.Empty, result.Message); return View(vm); } ModelState.AddModelError(string.Empty, "incorrect input"); return View(vm); }
public async Task<IActionResult> AddProfession(AddProfessionViewModel vm) { var compServ = new CompanyServices(uow); var appUser = await GetCurrentUserAsync(); var compResult = compServ.GetCompaniesForUser(appUser.Email); vm.Companies = CreateCompanyList(compResult.ReturnValue); if ( ModelState.IsValid) { var currentUser = uow.UserRepository.GetEagerLoad(u => u.Email.Equals(appUser.Email, StringComparison.OrdinalIgnoreCase) ).FirstOrDefault(); var adminServices = new AdminServices(uow); var result = adminServices.Addprofession(appUser.Email, vm.SelectedValue, currentUser.UserID , vm.Title, vm.Description); if( result.Success) { vm.Message = result.Message; return View(vm); } else { ModelState.AddModelError(string.Empty, result.Message); return View(vm); } } ModelState.AddModelError(string.Empty, "incorrect input"); return View(vm); }
public async Task<IActionResult> AddWageSchemaForProfession() { AddWageSchemaForProfessionViewModel vm = new AddWageSchemaForProfessionViewModel(); var compServ = new CompanyServices(uow); var currentUser = await GetCurrentUserAsync(); var compResult = compServ.GetCompaniesForUser(currentUser.Email); vm.Companies = CreateCompanyList(compResult.ReturnValue); vm.Professions = new SelectList(new List<SelectListItem>(), "Value", "Text"); return View(vm); }
public async Task<IActionResult> AddProfession() { var appUser = await GetCurrentUserAsync(); var compServ = new CompanyServices(uow); var result =compServ.GetCompaniesForUser(appUser.Email); if( !result.Success ) { ModelState.AddModelError(string.Empty, result.Message); return View(); } AddProfessionViewModel vm = new AddProfessionViewModel(); vm.Companies = CreateCompanyList(result.ReturnValue); return View(vm); }