public async Task <IActionResult> Insert(CarTransportationInsertViewModel model , IFormFile pic) { var result = await _carTransportRepository.InsertCar(model, pic); TempData.AddResult(result); return(Redirect(IndexUrlWithQueryString)); }
public async Task <SweetAlertExtenstion> InsertCar(CarTransportationInsertViewModel model, IFormFile file) { if (file == null) { model.Pic = "Images/no-Pic.jpg"; } else { model.Pic = await MFile.Save(file, FilePath.Cars.GetDescription()); } var result = model.ToEntity(); await AddAsync(result); return(SweetAlertExtenstion.Ok()); }