public IActionResult Delete(int?tournamentId)
        {
            try
            {
                if (!tournamentId.HasValue)
                {
                    return(StatusCode(400, StatusCodes.ReturnStatusObject("No parameter provided.")));
                }
                var result = _tournamentRepository.Delete(tournamentId);

                if (result)
                {
                    _logger.LogInformation($"ID : {tournamentId} has been successfully deleted.");
                    return(StatusCode(200, StatusCodes.ReturnStatusObject($"ID : {tournamentId} has been successfully deleted.")));
                }
                else
                {
                    _logger.LogError("Tournament ID : {0} was not deleted.", tournamentId);
                    return(StatusCode(400, StatusCodes.ReturnStatusObject($"Delete was unsuccessful.")));
                }
            }
            catch (Exception e)
            {
                _logger.LogError("The Tournament delete has failed. Error - {0}", e.Message);
                return(StatusCode(400, StatusCodes.ReturnStatusObject("The delete has failed.")));
            }
        }
Beispiel #2
0
        public virtual async Task <ActionResult> Delete(int ID)
        {
            _tournament.Delete(ID);
            await _uow.SaveChangesAsync();

            return(RedirectToAction("TournamentList"));
        }
Beispiel #3
0
 public int Delete(int id)
 {
     return(_tournament.Delete(id));
 }