public bool AddReservationItem(ReservationItemDTO item)
        {
            int result = 0;

            result = dataContext.ExecuteCommand(string.Format(DataResource.SQL_AddReservationItem, item.ItemName, item.QuantityOrdered, item.RemainingUnreserved));
            return(result > 0);
        }
Exemple #2
0
 public static ReservationItem ConvertReservationItem(ReservationItemDTO item)
 {
     return(new ReservationItem()
     {
         ID = item.ID,
         ItemName = item.ItemName,
         QuantityOrdered = item.QuantityOrdered,
         RemainingUnreserved = item.RemainingUnreserved
     });
 }
        public ReservationItemDTO GetOneReservation(int id)
        {
            ReservationItemDTO item = null;

            var data = dataContext.ReservationItems.Where(c => c.ID == id);

            foreach (ReservationItem d in data)
            {
                item = DTOConverter.ConvertReservationItem(d);
                var rData = dataContext.Reservers.Where(x => x.ItemID == item.ID);
                List <ReserverDTO> reservers = new List <ReserverDTO>();
                foreach (Reserver r in rData)
                {
                    reservers.Add(DTOConverter.ConvertReserver(r));
                }
                item.Reservers = reservers;
                break;
            }
            return(item);
        }