public async Task CreateAsync(CreateBusViewModel inputModel) { var bus = AutoMapperConfig.MapperInstance.Map <Bus>(inputModel); bus.Id = Guid.NewGuid().ToString(); await this.busesRepository.AddAsync(bus); await this.busesRepository.SaveChangesAsync(); }
public async Task <IActionResult> Create(CreateBusViewModel inputModel) { if (!this.ModelState.IsValid) { return(this.View(inputModel)); } await this.busesService.CreateAsync(inputModel); return(this.RedirectToAction("MyBuses")); }