public ActionResult <RoomDetail> CreateRoom(RoomCreate p)
        {
            var Room = this.mapper.Map <Room>(p);

            Room = this.RoomRepository.Create(Room);
            return(this.mapper.Map <RoomDetail>(Room));
        }
Example #2
0
        public async Task <ActionResult> Create(RoomCreate model)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(View(model));
                }

                var service = CreateRoomService();

                if (!await service.CreateRoomAsync(model))
                {
                    ModelState.AddModelError("", "Room could not be created.");

                    return(View(model));
                }


                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View(model));
            }
        }
 void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else if (Instance != this)
     {
         Destroy(gameObject);
     }
 }
Example #4
0
        private MainMessage RoomCreate(ulong msgId, RoomCreate create)
        {
            _log.Debug("In RoomCreate method.");
            Room room = new Room();

            room.Name         = create.Name;
            room.Capacity     = create.Capacity;
            room.Address      = new IPEndPoint(_api.OpenAPI.Config.ServerAddress, (int)_api.OpenAPI.Config.UdpPort);
            room.LastActivity = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
            lock (_roomList)
            {
                room.Id = (uint)_roomList.Count;
                _roomList.Add(room);
                OnRoomCreated(room);
                _log.Info($"Created new Room with ID {room.Id}.");
                return(RoomDetail(room.Id));
            }
        }
Example #5
0
        public RoomCreate Create([FromBody] CreateRoomRequest info)
        {
            var room = roomsManager.CreateNewRoom(repository.GetUserId(User), info);

            return(RoomCreate.Create(room.Id));
        }