Ejemplo n.º 1
0
        public Boolean BookTime(WashTimeViewModel vm)
        {
            if (vm.Time > DateTime.Now)
            {
                WashTime currentbooking = db.WashTimes.Find(vm.ID);
                if (currentbooking == null)
                {
                    return(false);
                }

                currentbooking.IsBooked        = true;
                currentbooking.RoomNumber      = vm.RoomNumber;
                db.Entry(currentbooking).State = EntityState.Modified;
                try
                {
                    db.SaveChangesAsync();
                    return(true);
                }
                catch (Exception)
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        public Boolean CancelBooking(WashTimeViewModel vm)
        {
            WashTime currentbooking = db.WashTimes.Find(vm.ID);

            if (currentbooking == null)
            {
                return(false);
            }
            currentbooking.IsBooked        = false;
            currentbooking.RoomNumber      = 0;
            db.Entry(currentbooking).State = EntityState.Modified;
            try
            {
                db.SaveChanges();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }