public async Task <bool> Create(AutoSaveInfo data)
        {
            //add created time
            data.CreatedAt = Timestamp.GetCurrentTimestamp();
            //create a new document with backup data
            var result = await _collection.AddAsync(data);

            //the result will have the newly created document's id if the save is successful. we can derive the save status based on that
            var status = !string.IsNullOrEmpty(result.Id);

            return(status);
        }
Beispiel #2
0
        // POST api/values
        public async Task <bool> PostAsync([FromBody] AutoSaveInfo data)
        {
            var status = await _repository.Create(data);

            return(status);
        }