Esempio n. 1
0
        public async Task <MeetingRoomSchedulingModel> PostMeetingRommScheduling(MeetingRoomSchedulingModel meetingRomm)
        {
            await CheckIfMeetingRoomSchedulingExists(meetingRomm.Date, meetingRomm.Number, meetingRomm.Hour);

            CheckIfIsValidHour(meetingRomm.Hour);

            try
            {
                return(await _meetingRoomSchedulingRepository.PostMeetingRommScheduling(meetingRomm));
            }
            catch (Exception)
            {
                throw new BusinessException("Não foi possivel reservar a sala");
            }
        }
Esempio n. 2
0
        public async Task <MeetingRoomSchedulingModel> PostMeetingRommScheduling(MeetingRoomSchedulingModel meetingRomm)
        {
            await _context.Database.EnsureCreatedAsync();

            _context.MeetingRoomScheduling.Add(new MeetingRoomSchedulingModel
            {
                Date        = meetingRomm.Date,
                Hour        = meetingRomm.Hour,
                Number      = meetingRomm.Number,
                CreatedDate = DateTime.Now
            });

            await _context.SaveChangesAsync();

            return(meetingRomm);
        }
Esempio n. 3
0
        public async Task <MeetingRoomSchedulingModel> PutMeetingRommScheduling(int id, MeetingRoomSchedulingModel meetingRoomScheduling)
        {
            await _context.Database.EnsureCreatedAsync();

            var upMeetingRoomScheduling = await _context.MeetingRoomScheduling.FirstOrDefaultAsync(a => a.Id.Equals(id));

            upMeetingRoomScheduling.Number = meetingRoomScheduling.Number;
            upMeetingRoomScheduling.Date   = meetingRoomScheduling.Date;
            upMeetingRoomScheduling.Hour   = meetingRoomScheduling.Hour;

            await _context.SaveChangesAsync();

            return(upMeetingRoomScheduling);
        }