public ActionResult <string> Delete(int id) { try { return(Ok(_ts.Delete(id))); } catch (Exception e) { return(BadRequest(e.Message)); } }
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)); } }
public ActionResult Delete(int? id) { TeamsService teamsService = new TeamsService(); if (!id.HasValue) { return RedirectToAction("List"); } teamsService.Delete(id.Value); return RedirectToAction("List"); }
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")); }