示例#1
0
        public IActionResult DeleteFile(int id)
        {
            var photoToDelete = (from p in _context.Photos where p.PhotoId == id select p).FirstOrDefault();

            _context.Remove(photoToDelete);
            _context.SaveChanges();

            return(RedirectToAction("Index"));
        }
示例#2
0
        public IActionResult DeletePhoto(int id)
        {
            var deleteId = (from c in _context.Photos where c.PhotoId == id select c).FirstOrDefault();

            _context.Remove(deleteId);

            _context.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#3
0
        public IActionResult Delete(Photo photo)
        {
            var deleteId = (from c in _context.Photos where c.PhotoId == c.PhotoId select c).FirstOrDefault(); //TODO DELETE THE RIGHT ONE NOT THE FIRST ONE EVERY TIME

            _context.Remove(deleteId);                                                                         //delete the id object

            _context.SaveChanges();                                                                            //save the changes
            return(RedirectToAction("Index"));
        }