예제 #1
0
        public IngredientFormViewModel(GroceriesContext context)
        {
            UnitRepository unitRepo = new UnitRepository(context);

            UnitsSelectList = new SelectList(unitRepo.GetUnits(), "Id", "PluralDescriptor");

            SectionRepository sectionRepo = new SectionRepository(context);

            SectionsSelectList = new SelectList(sectionRepo.GetSections(), "Id", "Name");
        }
예제 #2
0
        public IngredientFormViewModel(GroceriesContext context, Ingredient ingredient)
        {
            Id        = ingredient.Id;
            Name      = ingredient.Name;
            UnitId    = ingredient.UnitId;
            Unit      = ingredient.Unit;
            SectionId = ingredient.SectionId;
            Section   = ingredient.Section;

            UnitRepository unitQueries = new UnitRepository(context);

            UnitsSelectList = new SelectList(unitQueries.GetUnits(), "Id", "PluralDescriptor", UnitId);

            SectionRepository sectionQueries = new SectionRepository(context);

            SectionsSelectList = new SelectList(sectionQueries.GetSections(), "Id", "Name", SectionId);
        }
예제 #3
0
 public IngredientsController(GroceriesContext context, IIngredientRepository ingredientRepo)
 {
     _context        = context;
     _ingredientRepo = ingredientRepo;
 }
 public GroceriesController(ILogger <GroceriesController> logger)
 {
     _logger        = logger;
     this.Groceries = new GroceriesContext();
 }
예제 #5
0
 public UnitRepository(GroceriesContext context)
 {
     _context = context;
 }
예제 #6
0
 public TestController(GroceriesContext context)
 {
     _context = context;
 }
예제 #7
0
 public IngredientRepository(GroceriesContext context)
 {
     this._context = context;
 }
예제 #8
0
 public SectionRepository(GroceriesContext context)
 {
     _context = context;
 }