Esempio n. 1
0
 public JsonResult <JsonResponse <Produto> > Post(Produto produto, int estoque, Tipo tipo)
 {
     try
     {
         Produto entity = busines.Add(produto, tipo, estoque);
         return(Json(new JsonResponse <Produto> {
             Type = "success", Title = tipo.ToString() + "!", Message = $"Sucesso ao cadastrar o {tipo.ToString()}!", Entity = entity
         }));
     }
     catch (Exception ex)
     {
         return(Json(new JsonResponse <Produto> {
             Type = "error", Title = tipo.ToString() + "!", Message = ex.Message
         }));
     }
 }