コード例 #1
0
 public ActionResult <string> Delete(int id)
 {
     try
     {
         return(Ok(_ts.Delete(id)));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
コード例 #2
0
 public ActionResult <string> Delete(int id)
 {
     try
     {
         var creatorId = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value;
         return(Ok(_ps.Delete(creatorId, id)));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
コード例 #3
0
        public ActionResult Delete(int? id)
        {
            TeamsService teamsService = new TeamsService();

            if (!id.HasValue)
            {
                return RedirectToAction("List");
            }

            teamsService.Delete(id.Value);

            return RedirectToAction("List");
        }
コード例 #4
0
 public ActionResult Delete(int team_id)
 {
     try
     {
         if (!_teamService.Delete(team_id))
         {
             TempData["error"] = $"Problems with deleting team (Service error \"Delete\"). Try to move employee to another team firstly, then try again";
             return(RedirectToAction("Index"));
         }
     }
     catch (Exception e)
     {
         TempData["error"] = $"Problems with getting information from database (services) or deleting information. {e.Message}";
         return(RedirectToAction("Index"));
     }
     return(RedirectToAction("Index"));
 }