Пример #1
0
 public async Task <IActionResult> Post(Port value)
 {
     try
     {
         var    result   = context.Post(value);
         string username = User.Identity.Name;
         return(Ok(await result));
     }
     catch (Exception ex)
     {
         return(BadRequest(new ErrorMessage(ex.Message)));
     }
 }
Пример #2
0
 public IHttpActionResult Post(port value)
 {
     try
     {
         var    result   = context.Post(value);
         string username = User.Identity.Name;
         context.BroadcastData(result);
         return(Ok(result));
     }
     catch (Exception ex)
     {
         return(Content(HttpStatusCode.NotAcceptable, ex.Message));
     }
 }