public async Task <IActionResult> Create([FromForm] BiginspectViewModel model) { if (!this.ModelState.IsValid) { return(this.RedirectToAction("Create")); } await this.liftsService.AddSupportCompany(model.CreateInspectInputModel.LiftId, model.CreateInspectInputModel.SupportCompanyId); var userId = this.userManager.GetUserId(this.User); await this.inspectsService.CreateAsync( userId, model.CreateInspectInputModel.InspectTypeId, model.CreateInspectInputModel.LiftId, model.CreateInspectInputModel.Notes, model.CreateInspectInputModel.Prescriptions, model.CreateInspectInputModel.SupportCompanyId); return(this.RedirectToAction("All", "Lifts")); }
public async Task <IActionResult> Create(string id) { var inspectTypes = await this.inspectTypesService.GetAllInspectTypes(); var supportCompanies = await this.supportCompaniesService.GetAll(); var lift = this.liftsService.GetLift(id); var input = new InspectInputDataViewModel() { InspectTypes = inspectTypes, SupportCompanies = supportCompanies, Lift = lift, }; var viewModel = new BiginspectViewModel() { InspectInputDataViewModel = input, }; return(this.View(viewModel)); }