public IActionResult Post([FromBody] ReceitaAdd vmodel) { try { _receitaService.Add(vmodel); } catch (Exception) { return(BadRequest()); } return(Ok(vmodel)); }
public IActionResult Add(ReceitaAdd vmodel, IFormFile image) { vmodel.Imagem = ConvetToByteArray(image); _receitaService.Add(vmodel); AddMessages(); if (ValidOperation()) { return(RedirectToAction("Index")); } ViewBag.Categorias = _categoriaService.ListDropDown(); ViewBag.Ingredientes = _ingredienteService.ListDropDown(); return(View(vmodel)); }
public ActionResult <Receita> Add([FromBody] Receita receita) { return(Created("", _service.Add(receita))); }