public async Task <ApiResultLite> UpdateAsync(ReservationUpdateRequest request) { Reservation rv = await _context.Reservations.FindAsync(request.Id); if (rv == null) { return(new ApiErrorResultLite("Không tìm thấy")); } else { rv.Id = request.Id; rv.Paid = request.Paid; rv.Active = request.Active; rv.ReservationTypeId = request.ReservationTypeId; rv.UserId = request.UserId; rv.EmployeeId = request.EmployeeId; _context.Update(rv); int rs = await _context.SaveChangesAsync(); if (rs == 0) { return(new ApiErrorResultLite("Cập nhật thất bại")); } return(new ApiSuccessResultLite("Cập nhật thành công")); } }
public async Task <ApiResultLite> UpdateAsync(ScreeningUpdateRequest request) { Screening screening = await _context.Screenings.FindAsync(request.Id); if (screening == null) { return(new ApiErrorResultLite("Không tìm thấy")); } else { screening.Id = request.Id; screening.TimeStart = request.TimeStart; //screening.Surcharge = request.Surcharge; screening.FilmId = request.FilmId; screening.RoomId = request.RoomId; screening.KindOfScreeningId = request.KindOfScreeningId; _context.Update(screening); int rs = await _context.SaveChangesAsync(); if (rs == 0) { return(new ApiErrorResultLite("Cập nhật thất bại")); } return(new ApiSuccessResultLite("Cập nhật thành công")); } }
public async Task <ApiResultLite> UpdateAsync(RoomFormatUpdateRequest model) { RoomFormat room = await _context.RoomFormats.FindAsync(model.Id); if (room == null) { return(new ApiErrorResultLite("Không tìm thấy định dạng")); } else { room.Name = model.Name; room.Price = model.Price; _context.Update(room); await _context.SaveChangesAsync(); return(new ApiSuccessResultLite("Cập nhật thành công")); } }
public async Task <ApiResultLite> UpdateAsync(ReservationTypeUpdateRequest request) { ReservationType rvt = await _context.ReservationTypes.FindAsync(request.Id); if (rvt == null) { return(new ApiErrorResultLite("Không tìm thấy")); } else { rvt.Id = request.Id; rvt.Name = request.Name; _context.Update(rvt); int result = await _context.SaveChangesAsync(); if (result == 0) { return(new ApiErrorResultLite("Cập nhật thất bại")); } return(new ApiSuccessResultLite("Cập nhật thành công")); } }
public async Task <ApiResultLite> UpdateAsync(BanUpdateRequest request) { Ban ban = await _context.Bans.FindAsync(request.Id); if (ban == null) { return(new ApiErrorResultLite("Không tìm thấy")); } else { ban.Id = request.Id; ban.Name = request.Name; _context.Update(ban); int result = await _context.SaveChangesAsync(); if (result == 0) { return(new ApiErrorResultLite("Cập nhật thất bại")); } return(new ApiSuccessResultLite("Cập nhật thành công")); } }
public async Task <ApiResultLite> UpdateAsync(FilmGenreUpdateRequest request) { FilmGenre filmgenre = await _context.FilmGenre.FindAsync(request.Id); if (filmgenre == null) { return(new ApiErrorResultLite("Không tìm thấy")); } else { filmgenre.Id = request.Id; filmgenre.Name = request.Name; _context.Update(filmgenre); int result = await _context.SaveChangesAsync(); if (result == 0) { return(new ApiErrorResultLite("Cập nhật thất bại")); } return(new ApiSuccessResultLite("Cập nhật thành công")); } }
public async Task <ApiResultLite> UpdateAsync(KindOfSeatUpdateRequest request) { KindOfSeat seat = await _context.KindOfSeats.FindAsync(request.Id); if (seat == null) { return(new ApiErrorResultLite("Không tìm thấy")); } else { seat.Name = request.Name; seat.Surcharge = request.Surcharge; _context.Update(seat); if (await _context.SaveChangesAsync() != 0) { return(new ApiSuccessResultLite("Cập nhật thành công")); } else { return(new ApiErrorResultLite("Cập nhật thất bại mới thất bại")); } } }
public async Task<ApiResultLite> UpdateAsync(SeatUpdateRequest request) { Seat seat = await _context.Seats.FindAsync(request.Id); if (seat == null) { return new ApiErrorResultLite("Không tìm thấy"); } else { seat.Id = request.Id; seat.Row = request.Row; seat.Number = request.Number; seat.KindOfSeatId = request.KindOfSeatId; seat.RoomId = request.RoomId; _context.Update(seat); int rs = await _context.SaveChangesAsync(); if (rs == 0) { return new ApiErrorResultLite("Cập nhật thất bại"); } return new ApiSuccessResultLite("Cập nhật thành công"); } }
public async Task <ApiResultLite> UpdateAsync(TicketUpdateRequest request) { Ticket ticket = await _context.Tickets.FindAsync(request.Id); if (ticket == null) { return(new ApiErrorResultLite("Không tìm thấy")); } else { ticket.Price = request.Price; ticket.ScreeningId = request.ScreeningId; ticket.SeatId = request.SeatId; _context.Update(ticket); int rs = await _context.SaveChangesAsync(); if (rs == 0) { return(new ApiErrorResultLite("Cập nhật thất bại")); } return(new ApiSuccessResultLite("Cập nhật thành công")); } }
public async Task <ApiResultLite> UpdateAsync(PeopleUpdateRequest request) { People people = await _context.Peoples.FindAsync(request.Id); if (people == null) { return(new ApiErrorResultLite("Không tìm thấy")); } else { people.Id = request.Id; people.DOB = request.DOB; people.Description = request.Description; people.Name = request.Name; _context.Update(people); int rs = await _context.SaveChangesAsync(); if (rs == 0) { return(new ApiErrorResultLite("Cập nhật thất bại")); } return(new ApiSuccessResultLite("Cập nhật thành công")); } }