public TodoItemViewModel GetItem(Guid id)
 {
     using (var db = _provider.GetDatabase())
     {
         var todoLists = db.GetCollection <TodoItemViewModel>();
         return(todoLists.FindById(id));
     }
 }
Esempio n. 2
0
 public void SaveList(TodoListViewModel model)
 {
     using (var db = _provider.GetDatabase())
     {
         var collection = db.GetCollection <TodoListViewModel>();
         if (!collection.Update(model))
         {
             collection.Insert(model);
         }
     }
 }
Esempio n. 3
0
        public async Task <BookingDetails> AddBooking(BookingDetails request)
        {
            BookingDetails added;

            using (var db = _provider.GetDatabase())
            {
                var bookings = db.GetCollection <BookingDetails>("bookings");
                bookings.EnsureIndex(x => x.Id, true);

                bookings.Insert(request);

                var id = request.Id;
                added = bookings.FindById(id);
            }

            return(await Task.FromResult(added));
        }