Example #1
0
        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();
            }
        }
Example #2
0
        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);
        }
Example #3
0
 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();
     }
 }
Example #4
0
        public TodoController(TodoApiContext context)
        {
            _context = context;

            if (_context.TodoItems.Count() == 0)
            {
                _context.TodoItems.Add(new TodoItem {
                    Name = "Item1"
                });
                _context.SaveChanges();
            }
        }
Example #5
0
        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);
        }
Example #6
0
 public TodoRepository(TodoApiContext context) : base(context)
 {
 }
Example #7
0
 public ClientsController(TodoApiContext context)
 {
     _context = context;
 }
Example #8
0
 public TodoItemsController(TodoApiContext context)
 {
     _context = context;
 }
Example #9
0
 public ProjectRepository(TodoApiContext db) : base(db)
 {
 }
Example #10
0
 public RepositoryBase(TodoApiContext db)
 {
     _db = db;
 }
Example #11
0
 public NotesController(TodoApiContext context)
 {
     _context = context;
 }
Example #12
0
 public ProjectsController(TodoApiContext context)
 {
     _context = context;
 }
Example #13
0
 public UsersController(TodoApiContext context, ILogger <UsersController> logger, IMemoryCache cache)
 {
     _context = context;
     _logger  = logger;
     _cache   = cache;
 }