public ActionResult Deletar(int id, Models.Cardapio.Sobremesa collection) { try { data.DeleteSobremesa(collection, id); return(RedirectToAction(nameof(Listar))); } catch { return(View()); } }
public ActionResult Editar(int id, Models.Cardapio.Sobremesa collection, IFormFile pic) { try { if (pic != null) { collection.imagem = pic.FileName; var fileName = Path.Combine(he.WebRootPath + "\\uploadImages", Path.GetFileName(pic.FileName)); using (FileStream fs = new FileStream(fileName, FileMode.Create)) { pic.CopyTo(fs); } } data.EditSobremesa(collection, id); return(RedirectToAction(nameof(Listar))); } catch { return(View()); } }