示例#1
0
 public object DeleteTask(Task task, long userId)
 {
     logger.Log(LogLevel.Debug, $"ShareController.DeleteTask({Json(task)}, {userId})");
     try
     {
         if (ShareManager.UnshareTask(task, userId))
         {
             return(Ok());
         }
         else
         {
             return(NotFound());
         }
     }
     catch (Exception ex)
     {
         logger.Log(LogLevel.Error, $"ShareController.DeleteTask({Json(task)}, {userId}) - {ex}");
         //изменить http status code
         return(new Response(100, ex.Message));
     }
 }
 public object DeleteTask(long taskId, long userId)
 {
     logger.Log(LogLevel.Debug, $"ShareController.DeleteTask({taskId}, {userId})");
     try
     {
         if (ShareManager.UnshareTask(taskId, userId))
         {
             return(new HttpStatusCodeResult(200));
         }
         else
         {
             return(new HttpStatusCodeResult(404));
         }
     }
     catch (Exception ex)
     {
         logger.Log(LogLevel.Error, $"ShareController.DeleteTask({taskId}, {userId}) - {ex}");
         //изменить http status code
         return(Json(new Response(100, ex.Message), JsonRequestBehavior.AllowGet));
     }
 }