コード例 #1
0
        public static void PopulateDatabaseWithRecipess(IMealDBService db)
        {
            using (TransactionScope scope = new TransactionScope())
            {
                Recipe recipe1 = new Recipe()
                {
                    Name         = "Tiny Lasagna",
                    Description  = "Teeny Tiny Lasagna",
                    Instructions = "Cook very well, with much skill.",
                    CookTime     = 45,
                    PrepTime     = 25,
                    CreatorId    = 1
                };
                db.AddRecipe(recipe1);

                Recipe recipe2 = new Recipe()
                {
                    Name         = "Tiny Eggs",
                    Description  = "Teeny Tiny Eggs",
                    Instructions = "Cook very well, with much skill.",
                    CookTime     = 5,
                    PrepTime     = 5,
                    CreatorId    = 1
                };
                db.AddRecipe(recipe2);

                scope.Complete();
            }
        }
コード例 #2
0
        public static void PopulateDatabaseWithIngredients(IMealDBService db)
        {
            using (TransactionScope scope = new TransactionScope())
            {
                Ingredient ingredient1 = new Ingredient()
                {
                    Name   = "butter",
                    UserId = 1
                };


                Ingredient ingredient2 = new Ingredient()
                {
                    Name   = "flour",
                    UserId = 1
                };

                scope.Complete();
            }
        }
コード例 #3
0
        public static void PopulateDatabaseWithUsers(IMealDBService db)
        {
            using (TransactionScope scope = new TransactionScope())
            {
                PasswordHelper passHelper = new PasswordHelper("a");

                User user = new User()
                {
                    FirstName = "Mister",
                    LastName  = "Pink",
                    Username  = "******",
                    Email     = "*****@*****.**",
                };
                user.Hash = passHelper.Hash;
                user.Salt = passHelper.Salt;
                user.Id   = db.AddUser(user);

                scope.Complete();
            }
        }
コード例 #4
0
 public PantryController(IMealDBService dal) : base(dal)
 {
     _dal = dal;
 }
コード例 #5
0
 public RecipeController(IMealDBService dal) : base(dal)
 {
     _dal = dal;
 }
コード例 #6
0
 /// <summary>
 /// Getting access to DB
 /// </summary>
 /// <param name="db"></param>
 public MealPlanController(IMealDBService dal) : base(dal)
 {
     _dal = dal;
 }
コード例 #7
0
 public UserController(IMealDBService dal) : base(dal)
 {
     _dal = dal;
 }
コード例 #8
0
 /// <summary>
 /// Getting access to DB
 /// </summary>
 /// <param name="db"></param>
 public BaseController(IMealDBService dal)
 {
     _dal = dal;
 }