public async Task <ActionResult> RegisterRoom(BookRoomDto bookRoom) { if (!await _clientRepo.ClientExists(bookRoom.Email)) { return(StatusCode(400, new { Error = "Client has not been registered, kindly register before booking a room" })); } if (await _clientRepo.ClientExists(bookRoom.RoomNo, string.Concat(bookRoom.FirstName, bookRoom.LastName))) { return(StatusCode(400, new { Error = "Client has already booked this room" })); } var _bookRoom = await _roomRepo.BookRoom(bookRoom); if (_bookRoom == null) { return(StatusCode(500, new { Error = "Could not book room." })); } else { //send mail to admin _emailer.SendEmailToAdmin(_bookRoom); return(StatusCode(201, _bookRoom)); } }