public IActionResult delete(int?tournamentId)
 {
     try
     {
         var dbRecord = _tournamentService.Find(tournamentId);
         if (tournamentId.HasValue)
         {
             if (dbRecord != null)
             {
                 _logger.LogInformation($"Record {tournamentId} deleted");
                 _tournamentService.Delete(tournamentId);
                 return(Ok("Record deleted"));
             }
             else
             {
                 return(BadRequest("Record copuld not be deleted please try agin"));
             }
         }
         else
         {
             return(NotFound("Record not found"));
         }
     }
     catch (Exception ex)
     {
         _logger.LogInformation("Api delete request failed", ex);
         return(BadRequest("Record could not be deleted"));
     }
 }
Esempio n. 2
0
        public ActionResult DeleteConfirmed(int id)
        {
            Tournament tournament = tournamentService.GetById((int)id);

            tournamentService.Delete(tournament);
            return(RedirectToAction("Index"));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            var tournament = _tournamentService.Get(id);

            if (tournament == null)
            {
                return(HttpNotFound());
            }

            _tournamentService.Delete(id);
            return(RedirectToAction("Archived"));
        }
Esempio n. 4
0
        //[Authorize(Roles = PlayerRolesConst.MainPlayer)]
        public async Task <IActionResult> Delete(Guid id)
        {
            var result = _tournamentService.GetById(id);

            if (result == null)
            {
                return(BadRequest());
            }

            await _tournamentService.Delete(result.Id);

            return(Ok());
        }
Esempio n. 5
0
        public ActionResult Delete(int id, tournament a)
        {
            if (ModelState.IsValid)
            {
                tournament b = tournamentService.GetById(id);

                tournamentService.Delete(b);
                return(RedirectToAction("Index"));
            }
            else
            {
                return(View());
            }
        }
        private void Delete(TournamentBaseModel tournamentBaseModel)
        {
            TournamentBaseDTO tournamentBaseDTO = Mapper.Map <TournamentBaseModel, TournamentBaseDTO>(tournamentBaseModel);

            using (ITournamentService service = factory.CreateTournamentService())
            {
                ServiceMessage serviceMessage = service.Delete(tournamentBaseDTO);
                RaiseReceivedMessageEvent(serviceMessage);

                if (serviceMessage.IsSuccessful)
                {
                    Notify();
                }
            }
        }
        public async Task DeleteShouldRemoveTournamentById()
        {
            //Arrange
            const string       databaseName = "TournamentDelete";
            ITournamentService service      = await GetTournamentService(databaseName);

            //Act
            var tournamentId = 1;
            await service.Delete(tournamentId);

            var tournament = service.ById(tournamentId);

            //Assert
            Assert.True(tournament == null);
        }
 public async Task Delete(int id)
 {
     await _tournamentService.Delete(id);
 }
        public IActionResult Delete(int id)
        {
            var result = _tournamentService.Delete(id);

            return(Ok(_mapper.ToDTO(result)));
        }
        public async Task <IActionResult> Delete(int id)
        {
            await _tournamentService.Delete(id);

            return(new OkObjectResult(true));
        }