public async Task <IActionResult> CreateLoad(AddLoadInputModel model) { if (this.ModelState.IsValid == false) { var countries = await this.countriesService.GetAllCountriesAsync <AllCountiresCreateLoadViewModel>(); var priorityTypes = await this.priorityTypesService.GetAllPriorityAsync <AllPriorityLoadCreateViewModel>(); var truckTypes = await this.truckTypesService.GetAllTruckTypesAsync <AllTruckTypesLoadCreateViewModel>(); LoadCreateViewModel inputModel = new LoadCreateViewModel() { Countries = countries, Priorities = priorityTypes, TruckTypes = truckTypes, }; model.InputModel = inputModel; return(this.View(model)); } var userId = this.User.FindFirstValue(ClaimTypes.NameIdentifier); model.SteuUserId = userId; model.InputModel = new LoadCreateViewModel(); await this.loadsService.CreateLoadAsync(model, userId); return(this.Redirect("/Loads/AllLoads")); }
public async Task <IActionResult> CreateLoad() { var countries = await this.countriesService.GetAllCountriesAsync <AllCountiresCreateLoadViewModel>(); var priorityTypes = await this.priorityTypesService.GetAllPriorityAsync <AllPriorityLoadCreateViewModel>(); var truckTypes = await this.truckTypesService.GetAllTruckTypesAsync <AllTruckTypesLoadCreateViewModel>(); LoadCreateViewModel inputModel = new LoadCreateViewModel() { Countries = countries, Priorities = priorityTypes, TruckTypes = truckTypes, }; AddLoadInputModel model = new AddLoadInputModel() { InputModel = inputModel, }; string referer = this.Request.Headers["Referer"].ToString(); model.Referer = referer; return(this.View(model)); }