public async Task EditAsync(EditTruckAdViewModel inputModel) { var truckAd = AutoMapperConfig.MapperInstance.Map <TruckAd>(inputModel); this.truckAdsRepository.Update(truckAd); await this.truckAdsRepository.SaveChangesAsync(); }
public async Task <IActionResult> Edit(EditTruckAdViewModel inputModel) { if (!this.ModelState.IsValid) { return(this.View(inputModel)); } await this.truckAdsService.EditAsync(inputModel); return(this.RedirectToAction("MyTruckAds")); }