コード例 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Event eventEntity = _eventsRepository.GetWhere(x => x.ID == id).FirstOrDefault();

            _eventsRepository.Delete(eventEntity);
            return(RedirectToAction("Index"));
        }
コード例 #2
0
 public bool Deletar(int ID)
 {
     try
     {
         return(_eventsRepository.Delete(ID));
     }
     catch
     {
         return(false);
     }
 }
コード例 #3
0
ファイル: EventsController.cs プロジェクト: BartaskaM/debook
        public async Task <IActionResult> Delete(int id)
        {
            try
            {
                await _eventsRepository.Delete(id);

                return(NoContent());
            }
            catch (InvalidEventException)
            {
                return(NotFound());
            }
        }
コード例 #4
0
        public IActionResult Delete(int eventToDeleteId)
        {
            try
            {
                repository.Delete(eventToDeleteId);
            }
            catch (ArgumentException)
            {
                return(NotFound());
            }

            return(NoContent());
        }
コード例 #5
0
ファイル: GamesService.cs プロジェクト: kapcabbage/GamesTask
        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);
        }
コード例 #6
0
ファイル: EventService.cs プロジェクト: gdanielch9/MyNotes
 public void DeleteEvent(int id)
 {
     _eventsRepository.Delete(id);
 }
コード例 #7
0
 public void Delete(Guid id)
 {
     _eventsRepository.Delete(id);
 }
コード例 #8
0
 public IActionResult Delete(string id)
 {
     eventsRepo.Delete(id);
     return(RedirectToAction("Index"));
 }
コード例 #9
0
 public bool Delete(int id)
 {
     return(_IEventCategoryRepo.Delete(id));
 }