public async Task <Document> Post([FromBody] Contact inObj)
        {
            //Contact retObj = await _repository.GetAsync("1");
            bool retB = _repository.IsEmpty();

            if (retB) //|| !retObj.id.Equals("1"))
            {         // if items with id=1 is not found, pill up the collection with local repo
                // hopefully, this will need to be done ony once
                foreach (var o in _localContactsRepository.GetAll())
                {
                    await _repository.CreateAsync(o);
                }
            }
            // not post the incoming obj.
            var document = await _repository.CreateAsync(inObj);

            return(document);
        }
예제 #2
0
        public async Task <Document> Post([FromBody] Contact inObj)
        {
            //Contact retObj = await _repository.GetAsync("1");
            UserInfo u = getLoggedInUserInfo();

            if (u != null)
            {
                bool retB = _repository.IsEmpty(u.usergoogid);
                if (retB) //|| !retObj.id.Equals("1"))
                {         // if items with id=1 is not found, pill up the collection with local repo
                 // hopefully, this will need to be done ony once
                    foreach (var o in _localContactsRepositoryInMemory.GetAll())
                    {
                        await _repository.CreateAsync(u.usergoogid, o);
                    }
                }
                // not post the incoming obj.
                inObj.usergoogid = u.usergoogid;
                var document = await _repository.CreateAsync(u.usergoogid, inObj);

                return(document);
            }
            return(null);
        }