Ejemplo n.º 1
0
        public bool DeleteCinema(int id)
        {
            var tblCinema = _context.TblCinema.SingleOrDefault(m => m.CinemaId == id);

            tblCinema.IsDeleted = true;
            _context.TblCinema.Update(tblCinema);
            _context.Entry(tblCinema).State = EntityState.Modified;
            return(_context.SaveChanges() > 0);
        }
        public bool DeleteMovie(int id)
        {
            var tblmovie = _context.TblMovie.SingleOrDefault(m => m.MovieId == id);

            tblmovie.IsDeleted = true;
            _context.TblMovie.Update(tblmovie);
            _context.Entry(tblmovie).State = EntityState.Modified;
            return(_context.SaveChanges() > 0);
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> DeleteConfirmed(string id)
        {
            var aspNetUsers = await _context.AspNetUsers.SingleOrDefaultAsync(m => m.Id == id);

            aspNetUsers.IsDeleted = true;
            _context.AspNetUsers.Update(aspNetUsers);
            _context.Entry(aspNetUsers).State = EntityState.Modified;
            var userDeleted = await _context.SaveChangesAsync() > 0;

            return(RedirectToAction(nameof(Index)));
        }
        public async Task <IActionResult> RemoveReservation([FromBody] int reservationId)
        {
            var reservation = await _context.TblReservations.Where(r => r.ReservationId == reservationId).FirstOrDefaultAsync();

            if (reservation != null)
            {
                reservation.IsDeleted = true;
                _context.TblReservations.Update(reservation);
                _context.Entry(reservation).State = EntityState.Modified;

                if (_context.SaveChanges() > 0)
                {
                    return(Ok());
                }
                else
                {
                    return(BadRequest("Could not delete reservation"));
                }
            }
            else
            {
                return(BadRequest("Could not find reservation"));
            }
        }
 public bool EditAddress(TblAddress address)
 {
     _context.TblAddress.Update(address);
     _context.Entry(address).State = EntityState.Modified;
     return(_context.SaveChanges() > 0);
 }