Beispiel #1
0
        public async Task <bool> UpdateRoom(RoomPOCO room)
        {
            var roomToChange = _roomRepository.Find(r => r.RoomId.Equals(room.RoomId)).First();
            //TO DO : Implement check if room can be changed - only if there is no upcoming examination booked in that room
            await _roomRepository.Delete(roomToChange);

            if (await _roomRepository.Create(_mapper.Map <RoomPOCO, Room>(room)))
            {
                return(true);
            }
            return(false);
        }
Beispiel #2
0
        public async Task <bool> AddRoomToClinic(RoomPOCO room)
        {
            room.RoomId = Guid.NewGuid();
            try
            {
                await _roomRepository.Create(_mapper.Map <RoomPOCO, Room>(room));

                return(true);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Beispiel #3
0
        public async Task <bool> DeleteRoom(RoomPOCO room)
        {
            var examinationsInRoom = _examinationRepository.Find(examination => examination.RoomId.Equals(room.RoomId)).ToList();

            foreach (Examination examination in examinationsInRoom)
            {
                if (examination.Status.Equals(ExaminationStatus.Accepted))
                {
                    return(false);
                }
            }
            await _roomRepository.Delete(_mapper.Map <RoomPOCO, Room>(room));

            return(true);
        }