Beispiel #1
0
        public IActionResult Delete(int id)
        {
            var newsEventFromRepo = _services.GetByID(id);

            if (newsEventFromRepo == null)
            {
                return(BadRequest("Not a value newsEvent id"));
            }
            _services.Delete(newsEventFromRepo);
            _services.SaveChange();

            return(Ok());
        }
Beispiel #2
0
        public ActionResult DeletePost(Guid id)
        {
            var photoModel = _newsEventService.GetAll().Where(x => x.Id == id).SingleOrDefault();

            try
            {
                _newsEventService.Delete(photoModel);
                _newsEventService.Save();

                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                return(View(photoModel));
            }
        }