public async Task <IActionResult> DeleteCoach([Range(1, int.MaxValue)] int coachId, CancellationToken cancellationToken) { var deleted = await _coachService.DeleteCoach(coachId, cancellationToken); if (deleted) { return(Ok()); } return(NotFound("No coach")); }
public IActionResult DeleteCoach(Guid coachId) { if (!coachId.IsEmpty()) { var response = coachService.DeleteCoach(new DeleteCoachRequest { ClubId = club.Guid, CoachId = coachId }); } return(ActionResultOnSuccess()); }
public IActionResult Delete(Coach coach) { EnsureCoachServiceInitialized(); var response = _coachService.DeleteCoach(coach.Id); if (IsErrorResponse(response, out var actionResult)) { return(actionResult); } return(RedirectToAction(nameof(Index))); }
public IActionResult Delete(int id) { try { service.DeleteCoach(id); } catch (Exception ex) { return(Content("\tERROR!\n\n ", ex.Message)); } return(RedirectToAction("Index")); }
public ActionResult DeleteCoach(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CoachVm coachVm = service.DeleteCoach(id); if (coachVm == null) { return(HttpNotFound()); } return(View(coachVm)); }
public async Task Delete_Failed_Incorrect_Id(int id) { Setup(); var coaches = GenerateListOfCoches(); _applicationContextMock.Setup(x => x.Coaches).ReturnsDbSet(coaches); _testedService = new CoachService(Logger, _applicationContextMock.Object); var result = (await _testedService.DeleteCoach(id, CancellationToken.None)); Assert.False(result); }
private void DeleteCoach() { PrintSpecial(Label("DELETE COACH")); try { Print("Id of the coach:"); int id = int.Parse(Console.ReadLine()); Print(""); coachService.DeleteCoach(id); Print("Coach deleted successfully!"); } catch (ArgumentException e) { Print(e.Message); } catch (Exception) { Print(SomethingWentWrong()); } }
public ActionResult DeleteCoach(int coachId) { _coachService.DeleteCoach(coachId); return(RedirectToAction("Index")); }