Exemplo n.º 1
0
        public async Task <ActionResult <RoomDataModel> > GetAsync(int id)
        {
            RoomDataModel roomModel = await _roomService.GetAsync(id);

            if (roomModel == null)
            {
                return(BadRequest(new { message = "Room with this id is not exsist." }));
            }

            return(Ok(roomModel));
        }
Exemplo n.º 2
0
 public void SaveAsync()
 {
     //  Hostel.hostelName = HostelName;
     if (RoomData.areaId == null || RoomData.areaId.Length == 0)
     {
         App.Current.MainPage.DisplayAlert("", "Please Select Area", "OK");
     }
     else if (RoomData.hostelId == null || RoomData.hostelId.Length == 0)
     {
         App.Current.MainPage.DisplayAlert("", "Please Select Hostel", "OK");
     }
     else if (RoomData.blockId == null || RoomData.blockId.Length == 0)
     {
         App.Current.MainPage.DisplayAlert("", "Please Select Block", "OK");
     }
     else if (RoomData.floorId == null || RoomData.floorId.Length == 0)
     {
         App.Current.MainPage.DisplayAlert("", "Please Select Floor", "OK");
     }
     else if (RoomData.name == null || RoomData.name.Length == 0)
     {
         App.Current.MainPage.DisplayAlert("", "Please Enter Room Name", "OK");
     }
     else if (RoomData.bedno == null || RoomData.bedno.Length == 0)
     {
         App.Current.MainPage.DisplayAlert("HMS", "Please Enter No of beds", "OK");
     }
     else
     {
         RoomDataModel roomDataModel = new RoomDataModel();
         roomDataModel.roomName         = RoomData.name;
         roomDataModel.hostelId         = RoomData.hostelId;
         roomDataModel.hostelRoomTypeId = RoomData.hostelRoomTypeId;
         roomDataModel.hostelBlockId    = RoomData.blockId;
         roomDataModel.floorId          = RoomData.floorId;
         roomDataModel.noOfBeds         = RoomData.bedno;
         roomDataModel.userId           = App.userid;
         web.SaveRoomEntry(roomDataModel);
     }
 }
Exemplo n.º 3
0
 private RoomModel ParseRoom(RoomDataModel room)
 {
     return(new RoomModel(room.Id, room.Name, room.Description));
 }
Exemplo n.º 4
0
        private RoomDataModel getChatData(ChatRoomData room, string id, List <ConversionalQueue> members, List <UserApp> users)
        {
            RoomDataModel outputModel = new RoomDataModel();

            outputModel.IdRoom   = room.Id;
            outputModel.RoomName = room.GroupName;
            outputModel.SederId  = id;
            double actualTime = room.TimeOfStart.Subtract(DateTime.Now).TotalMilliseconds;

            outputModel.TimeConfersation = 900000 + actualTime;
            foreach (var user in users)
            {
                foreach (var member in members)
                {
                    if (member.UserId == user.Id)
                    {
                        if (member.SiteName == RoomSides.FirstWiew)
                        {
                            outputModel.FirstMember = new ChatMemberModel
                            {
                                Email    = user.Email,
                                FakeName = member.FakeName,
                                SiteName = member.SiteName,
                                Number   = 1,
                            };
                            if (member.UserId == id)
                            {
                                outputModel.FirstMember.IsSender = true;
                                outputModel.SederName            = member.FakeName;
                            }
                            else
                            {
                                outputModel.FirstMember.IsSender = false;
                            }
                        }
                        else if (member.SiteName == RoomSides.SecondWiew)
                        {
                            outputModel.SecondMember = new ChatMemberModel
                            {
                                Email    = user.Email,
                                FakeName = member.FakeName,
                                SiteName = member.SiteName,
                                Number   = 1,
                            };
                            if (member.UserId == id)
                            {
                                outputModel.SecondMember.IsSender = true;
                                outputModel.SederName             = member.FakeName;
                            }
                            else
                            {
                                outputModel.SecondMember.IsSender = false;
                            }
                        }
                        else if (member.SiteName == RoomSides.ThirdWiew)
                        {
                            outputModel.ThirdMember = new ChatMemberModel
                            {
                                Email    = user.Email,
                                FakeName = member.FakeName,
                                SiteName = member.SiteName,
                                Number   = 1,
                            };
                            if (member.UserId == id)
                            {
                                outputModel.ThirdMember.IsSender = true;
                                outputModel.SederName            = member.FakeName;
                            }
                            else
                            {
                                outputModel.ThirdMember.IsSender = false;
                            }
                        }
                        else if (member.SiteName == RoomSides.FourWiew)
                        {
                            outputModel.FourMember = new ChatMemberModel
                            {
                                Email    = user.Email,
                                FakeName = member.FakeName,
                                SiteName = member.SiteName,
                                Number   = 1,
                            };
                            if (member.UserId == id)
                            {
                                outputModel.FourMember.IsSender = true;
                                outputModel.SederName           = member.FakeName;
                            }
                            else
                            {
                                outputModel.FourMember.IsSender = false;
                            }
                        }
                        else if (member.SiteName == RoomSides.FiftyWiew)
                        {
                            outputModel.FiftyMember = new ChatMemberModel
                            {
                                Email    = user.Email,
                                FakeName = member.FakeName,
                                SiteName = member.SiteName,
                                Number   = 1,
                            };
                            if (member.UserId == id)
                            {
                                outputModel.FiftyMember.IsSender = true;
                                outputModel.SederName            = member.FakeName;
                            }
                            else
                            {
                                outputModel.FiftyMember.IsSender = false;
                            }
                        }
                    }
                }
            }
            return(outputModel);
        }