예제 #1
0
 public async Task <IActionResult> DeleteFileReport(long idCompany, [FromRoute(Name = "idFile")] long idFile)
 {
     try
     {
         var fileEntity = _filesRepository.DeleteById(idFile);
         if (fileEntity != null)
         {
             if (fileEntity == true)
             {
                 return(new OkObjectResult(new { message = "deleted" }));
             }
             return(new ObjectResult(new { message = "not deleted" })
             {
                 StatusCode = 500
             });
         }
         return(new ObjectResult(new { message = "not found" })
         {
             StatusCode = 404
         });
     }
     catch (Exception e)
     {
         return(new ObjectResult(new { message = e.Message })
         {
             StatusCode = 500
         });
     }
 }
예제 #2
0
 public int Delete(int id)
 {
     try
     {
         return(_filesRepository.DeleteById(id));
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }