Ejemplo n.º 1
0
 public IActionResult DeleteStyle(long id)
 {
     _logger.LogInformation($"{nameof(StyleController)} : {nameof(DeleteStyle)} was called.");
     try
     {
         var style = _styleService.FindById(id);
         if (style == null)
         {
             return(StatusCode((int)HttpStatusCode.Gone));
         }
         _styleService.Delete(style);
         _styleService.Save();
         return(Ok());
     }
     catch (DbException exception)
     {
         _logger.LogError(exception.Message);
         return(BadRequest(exception.Message));
     }
     catch (Exception exception)
     {
         _logger.LogError(exception.Message);
         throw;
     }
 }