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"));
        }
Exemple #2
0
 public IActionResult DeleteCoach(Guid coachId)
 {
     if (!coachId.IsEmpty())
     {
         var response = coachService.DeleteCoach(new DeleteCoachRequest {
             ClubId  = club.Guid,
             CoachId = coachId
         });
     }
     return(ActionResultOnSuccess());
 }
Exemple #3
0
        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"));
        }
Exemple #5
0
        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);
        }
Exemple #7
0
        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());
            }
        }
Exemple #8
0
        public ActionResult DeleteCoach(int coachId)
        {
            _coachService.DeleteCoach(coachId);

            return(RedirectToAction("Index"));
        }