public void NoteData(DbContextOptions <TodoApiContext> options) { using (var todocontext = new TodoApiContext(options)) { var note = new List <Note>() { new Note() { ID = 1, Title = "Boeing", PlainText = "Aerospace company", Pinned = false, CheckLists = new List <CheckList>() { new CheckList() { CheckListData = "Jumbo Jet", Status = true } }, Labels = new List <Label>() { new Label() { LabelData = "Dreamliner" } } }, new Note() { ID = 3, Title = "Boeings", PlainText = "Aerospace companys", Pinned = false, CheckLists = new List <CheckList>() { new CheckList() { CheckListData = "Jumbo Jets", Status = true } }, Labels = new List <Label>() { new Label() { LabelData = "Dreamliners" } } } }; todocontext.Note.AddRange(note); todocontext.SaveChanges(); } }
public UnitTest1() { var optionsBuilder = new DbContextOptionsBuilder <TodoApiContext>(); optionsBuilder.UseInMemoryDatabase(Guid.NewGuid().ToString()); TodoApiContext context = new TodoApiContext(optionsBuilder.Options); _controller = new NotesController(context); NoteData(optionsBuilder.Options); }
public TodoController(TodoApiContext context) { _context = context; if (_context.Tareas.Count() == 0) { // Create a new TodoItem if collection is empty, _context.Tareas.Add(new Tarea { Descripcion = "Item1" }); _context.SaveChanges(); } }
public TodoController(TodoApiContext context) { _context = context; if (_context.TodoItems.Count() == 0) { _context.TodoItems.Add(new TodoItem { Name = "Item1" }); _context.SaveChanges(); } }
private Todo create(object args) { Todo todo = this.Bind(); var connection = @"Server=localhost;Port=5432;User ID=postgres;Password=postgres;Database=nancy;"; var options = new DbContextOptionsBuilder <TodoApiContext>(); options.UseNpgsql(connection); using (var context = new TodoApiContext(options.Options)) { context.Add <Todo>(todo); context.SaveChanges(); } return(todo); }
public TodoRepository(TodoApiContext context) : base(context) { }
public ClientsController(TodoApiContext context) { _context = context; }
public TodoItemsController(TodoApiContext context) { _context = context; }
public ProjectRepository(TodoApiContext db) : base(db) { }
public RepositoryBase(TodoApiContext db) { _db = db; }
public NotesController(TodoApiContext context) { _context = context; }
public ProjectsController(TodoApiContext context) { _context = context; }
public UsersController(TodoApiContext context, ILogger <UsersController> logger, IMemoryCache cache) { _context = context; _logger = logger; _cache = cache; }