public ActionResult DeleteConfirmed(int id)
        {
            Event eventEntity = _eventsRepository.GetWhere(x => x.ID == id).FirstOrDefault();

            _eventsRepository.Delete(eventEntity);
            return(RedirectToAction("Index"));
        }
Example #2
0
 public bool Deletar(int ID)
 {
     try
     {
         return(_eventsRepository.Delete(ID));
     }
     catch
     {
         return(false);
     }
 }
Example #3
0
        public async Task <IActionResult> Delete(int id)
        {
            try
            {
                await _eventsRepository.Delete(id);

                return(NoContent());
            }
            catch (InvalidEventException)
            {
                return(NotFound());
            }
        }
        public IActionResult Delete(int eventToDeleteId)
        {
            try
            {
                repository.Delete(eventToDeleteId);
            }
            catch (ArgumentException)
            {
                return(NotFound());
            }

            return(NoContent());
        }
Example #5
0
        public OperationResult <bool> DeleteGame(int id)
        {
            var result = new OperationResult <bool>();

            try
            {
                var Game = _gameRepo.Get(id);
                if (Game != null)
                {
                    var events = _eventRepo.GetAll(id);
                    foreach (var eventEntity in events)
                    {
                        _eventRepo.Delete(eventEntity);
                    }
                    _gameRepo.Delete(Game);
                    var saveResult = _context.SaveChanges();
                    if (saveResult > 0)
                    {
                        result.Data   = true;
                        result.Status = eOperationStatus.Success;
                    }
                    else
                    {
                        result.Data   = false;
                        result.Status = eOperationStatus.GeneralError;
                    }
                }
                else
                {
                    result.Data   = false;
                    result.Status = eOperationStatus.NotFound;
                }
            }
            catch (Exception ex)
            {
                result.Data             = false;
                result.Status           = eOperationStatus.GeneralError;
                result.ExceptionMessage = ex.Message;
            }

            return(result);
        }
Example #6
0
 public void DeleteEvent(int id)
 {
     _eventsRepository.Delete(id);
 }
Example #7
0
 public void Delete(Guid id)
 {
     _eventsRepository.Delete(id);
 }
Example #8
0
 public IActionResult Delete(string id)
 {
     eventsRepo.Delete(id);
     return(RedirectToAction("Index"));
 }
Example #9
0
 public bool Delete(int id)
 {
     return(_IEventCategoryRepo.Delete(id));
 }