public async Task <IActionResult> Add(AnimalTaxonomyView result) { if (!ModelState.IsValid) { return(View(result)); } await _animalTaxonomyService.Create(AnimalTaxonomyHelpers.ConvertToModel(result)); return(RedirectToAction("List")); }
public async Task <IActionResult> Add(SpiderAnimalTaxonomyView result) { if (!ModelState.IsValid) { ViewData["AnimalTaxonomy"] = await _animalTaxonomyService.GetAll(); return(View(result)); } var spiderModel = SpiderHelpers.ConvertSpiderToModel(result); var animalTaxonomyModel = SpiderHelpers.ConvertAnimalTaxonomyToModel(result); await _animalTaxonomyService.Create(animalTaxonomyModel); var animalTaxonomyId = animalTaxonomyModel.Id; await _spiderService.Create(spiderModel, animalTaxonomyId); await _cloudinaryService.AddSpiderImage(result.Spider.SpiderFileImg, spiderModel.Id); return(RedirectToAction("List")); }