예제 #1
0
        public async Task <ActionResult <string> > RegisterHousing([FromBody] HousingRegisterModel toCreate)
        {
            try
            {
                string id = await _housingsService.RegisterHousingAsync(toCreate);

                return(Ok(id));
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }
예제 #2
0
        private async Task <string> RegisterToDatabase(HousingRegisterModel toRegister)
        {
            Housing dbHousing = new()
            {
                HousingType   = toRegister.HousingType,
                HousingFloor  = toRegister.HousingFloor,
                IsElevator    = toRegister.IsElevator,
                Surface       = toRegister.Surface,
                Adress        = toRegister.Adress,
                Town          = toRegister.Town,
                Zipcode       = toRegister.Zipcode,
                Region        = toRegister.Region,
                Country       = toRegister.Country,
                State         = toRegister.State,
                MoveRequestId = toRegister.MoveRequestId,
            };

            await _housings.InsertOneAsync(dbHousing);

            return(dbHousing.Id);
        }
예제 #3
0
        public async Task <string> RegisterHousingAsync(HousingRegisterModel housingRegisterModel)
        {
            string id = await RegisterToDatabase(housingRegisterModel);

            return(id);
        }