Beispiel #1
0
        public async Task AddSlot(AcceptedSlot newAcceptedSlot)
        {
            _context.Add(newAcceptedSlot);
            Slot slot = _context.Slots.Find(newAcceptedSlot.SlotID);

            slot.IsAvailable = false;
            await _context.SaveChangesAsync();
        }
Beispiel #2
0
        public async Task DeleteSlot(int slotId)
        {
            AcceptedSlot ac = _context.AcceptedSlots.Find(slotId);

            if (ac != null)
            {
                _context.Slots.Find(ac.SlotID).IsAvailable = true;
                _context.AcceptedSlots.Remove(ac);
                await _context.SaveChangesAsync();
            }
        }
        public async Task <IActionResult> OnPost(int id, int mvId, string mvOW, AcceptedSlot newSlot)
        {
            if (AcceptedSlot.ClientName != null && AcceptedSlot.ClientContactMail != null)
            {
                //NOT DONE!! firstly correct display slots and reduct form!!
                AcceptedSlot.SlotID = id;
                AcceptedSlot.Owner  = mvOW;
                await _acRepo.AddSlot(AcceptedSlot);

                return(Redirect("/Index"));
            }
            else
            {
                return(Redirect("/Stranger/MeetingReservation/" + mvId + "?day=" + id + "&course=" + id));
            }
        }