Exemplo n.º 1
0
        public async Task <model.ListModel> AddList(string userId, model.ListModel list)
        {
            var insertOptions = new InsertOneOptions
            {
                BypassDocumentValidation = false,
            };

            var storageList = list.Map(userId);
            await MongoDbUtil.GetCollection <List>(DBNAME, COLLECTION_LIST).InsertOneAsync(storageList, insertOptions);

            return(list);
        }
Exemplo n.º 2
0
 public static storage.List Map(this model.ListModel list, string userId)
 {
     return(new storage.List()
     {
         UserId = userId,
         Id = list.Id,
         Name = list.Name,
         Items = list.Items.Select(li => new storage.ListItem()
         {
             Id = li.Id,
             Question = li.Question,
             Answer = li.Answer,
         }).ToList(),
     });
 }