Exemple #1
0
 public async Task <IHttpActionResult> PostPersona(PersonaBE be)
 {
     try
     {
         if (!ModelState.IsValid)
         {
             return(BadRequest(ModelState));
         }
         _services.Create(be);
         return(Created(new Uri(Url.Link("DefaultApi", new { Id = be.id_persona })), be));
     }
     catch (Exception ex)
     {
         var except = (ApiBusinessException)HandlerErrorExceptions.GetInstance().RunCustomExceptions(ex);
         var resp   = BadRequest(Convert.ToString(except.ErrorDescription));
         return(resp);
     }
 }
Exemple #2
0
 public async Task <IActionResult> Post([FromBody] PersonaViewModel model)
 {
     return(await _services.Create(model));
 }