Ejemplo n.º 1
0
        public async Task <JObject> Post(Apartment ap)
        {
            var userId = User.FindFirst("sub")?.Value;

            _logger.LogInformation("Adding new apartment owned by " + User.Identity.Name);

            var phoneNum = TrueHomeContext.getPhoneNumber(userId);

            if (phoneNum == null)
            {
                TrueHomeContext.setPhoneNumber(ap.PhoneNumber, userId);
            }

            ap.IDUser = userId;
            var id = await TrueHomeContext.createApartment(ap);

            return(JObject.Parse("{\"id\": " + id + ", \"UploadStatus\": " + 1 + "}"));
        }
Ejemplo n.º 2
0
        public JObject getPhoneNumber()
        {
            var userId = User.FindFirst("sub")?.Value;

            string phoneNumber = TrueHomeContext.getPhoneNumber(userId);
            string jsonData    = null;

            if (phoneNumber == null)
            {
                jsonData = "{ 'phoneNumber': null }";
            }
            else
            {
                jsonData = "{'phoneNumber': " + $"'{phoneNumber}'" + "'}";
            }

            return(JObject.Parse(jsonData));
        }