public TodoItemViewModel GetItem(Guid id) { using (var db = _provider.GetDatabase()) { var todoLists = db.GetCollection <TodoItemViewModel>(); return(todoLists.FindById(id)); } }
public void SaveList(TodoListViewModel model) { using (var db = _provider.GetDatabase()) { var collection = db.GetCollection <TodoListViewModel>(); if (!collection.Update(model)) { collection.Insert(model); } } }
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)); }