Beispiel #1
0
 /// <summary>
 /// Cập nhật Seat theo Id
 /// </summary>
 /// <param name="UserEntity"></param>
 /// <param name="SeatId"></param>
 /// <param name="SeatEntity"></param>
 /// <returns></returns>
 public SeatEntity Update(UserEntity UserEntity, int SeatId, SeatEntity SeatEntity)
 {
     using (var transaction = CinemasEntities.Database.BeginTransaction())
     {
         try
         {
             Seat Seat = CinemasEntities.Seats.Where(c => c.Id.Equals(SeatId)).FirstOrDefault();
             if (Seat == null)
             {
                 throw new BadRequestException("Không tìm thấy Seat có Id là " + SeatId);
             }
             Seat = SeatEntity.ToModel(Seat);
             CinemasEntities.SaveChanges();
             transaction.Commit();
             return(SeatEntity);
         }
         catch (Exception ex)
         {
             transaction.Rollback();
             throw new BadRequestException("Không cập nhập được Seat");
         }
     }
 }
Beispiel #2
0
 public SeatEntity Update([FromUri] int OrderId, [FromBody] SeatEntity OrderEntity)
 {
     return(SeatService.Update(UserEntity, OrderId, OrderEntity));
 }
Beispiel #3
0
 public SeatEntity Create([FromBody] SeatEntity SeatEntity)
 {
     return(SeatService.Create(UserEntity, SeatEntity));
 }