예제 #1
0
        async void OnRefresh(object sender, EventArgs e)
        {
            // Turn on network indicator
            if (!CrossConnectivity.Current.IsConnected)
            {
                return;
            }
            this.IsBusy = true;

            try
            {
                var recipeCollection = await manager.GetAll();

                foreach (Recipe recipe in recipeCollection)
                {
                    if (recipe.thumbnail == "")
                    {
                        recipe.thumbnail = "RecipeBook.png";
                    }
                    if (recipes.All(b => b.title != recipe.title))
                    {
                        recipes.Add(recipe);
                    }
                }
            }
            finally
            {
                this.IsBusy = false;
            }
        }
 public IActionResult GetAll([FromQuery] int?accountId, [FromQuery] int?pageNumber, [FromQuery] string sortText, [FromQuery] bool?isAscending, [FromQuery] string query = "")
 {
     if (query == null)
     {
         query = "";
     }
     if (pageNumber.HasValue && isAscending.HasValue && query != null && sortText != null)
     {
         return(Ok(manager.GetAll(pageNumber.Value, isAscending.Value, query, sortText)));
     }
     else
     {
         return(Ok(manager.GetAll()));
     }
 }
예제 #3
0
        public static void Main(string[] args)
        {
            //Setup Database
            var mj = new MakeJsonFiles(new FileClient());

            mj.CreateAllTables();

            //Poor Man DI
            var ingredientRepository        = new IngredientRepository(new FileClient());
            var recipeRepository            = new RecipeRepository(new FileClient());
            var recipeIngredientRespository = new RecipeIngredientRepository(new FileClient());
            var recipeManager = new RecipeManager(
                ingredientRepository,
                recipeRepository,
                recipeIngredientRespository
                );

            //Start Program
            var recipes = recipeManager.GetAll();

            foreach (var recipe in recipes)
            {
                var receipt = new RecipeReceipt(recipe);
                Console.WriteLine(receipt.ToString());
            }
        }
예제 #4
0
        public IActionResult Index()
        {
            List <Recipe.Monolith.Models.Recipe> recipes = RecipeManager.GetAll(12);

            ViewData["Recipes"] = recipes;
            ViewData["Title"]   = "Fabrikam Recipes";

            return(View());
        }