コード例 #1
0
 public IActionResult AddLabel(int id, [FromBody] Label label)
 {
     try
     {
         noteservice.AddLabel(id, label);
         return(Created("Added new label", label));
     }
     catch (Exception ex)
     {
         return(StatusCode(500, "Internal Server Error"));
     }
 }
コード例 #2
0
 public IActionResult AddLabel(int id, Label label)
 {
     try
     {
         var result = noteService.AddLabel(id, label);
         return(Created(new Uri("api/notes/" + id, UriKind.Relative), result));
     }
     catch (LabelNotFoundException ex)
     {
         return(NotFound(ex));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex));
     }
 }