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

            return(RedirectToAction("Index"));
        }