Exemplo n.º 1
0
 public void Load(CardId left, CardId middle, CardId right, FoodId food)
 {
     SetCard(left, 0);
     SetCard(middle, 1);
     SetCard(right, 2);
     SetFood(food);
 }
Exemplo n.º 2
0
        public FoodModel GetFoodById(FoodId foodId)
        {
            FoodModel foodModel = new FoodModel();

            using (ISession session = NHibernateSession.OpenSession())  // Open a session to conect to the database
            {
                var food = session.Query <Food>().FirstOrDefault(c => c.FoodId == foodId.Value);
                if (food != null)
                {
                    foodModel = food.ToFoodModel();
                }
            }
            return(foodModel);
        }
        public List <(string, string)> GetParameters(bool isPremier)
        {
            var headers = new List <(string, string)>();

            headers.Add(("method", _method));
            headers.Add(("food_id", FoodId.ToString()));
            if (!isPremier)
            {
                return(headers);
            }
            headers.Add(("flag_default_serving", FlagDefaultServing.ToString()));
            headers.Add(("include_sub_categories", IncludeSubCategories.ToString()));
            return(headers);
        }
Exemplo n.º 4
0
        public JObject Get()
        {
            var lines = System.IO.File.ReadAllLines("FoodTable.txt");

            FoodId[] foodTable = new FoodId[lines.Length];
            for (int i = 0; i < lines.Length; i++)
            {
                string[] tokens  = lines[i].Split("||");
                string   address = tokens[0];
                int      id      = int.Parse(tokens[1]);
                string   name    = tokens[2];
                foodTable[i] = new FoodId(address, id, name);
            }

            return(JObject.Parse("{ FoodItems: " + JsonConvert.SerializeObject(foodTable) + " }"));
        }
Exemplo n.º 5
0
 public static FoodData Find(FoodId id) => list[id];
Exemplo n.º 6
0
 public FoodModel GetFoodById(FoodId foodId)
 {
     return(_foodRepository.GetFoodById(foodId));
 }
Exemplo n.º 7
0
 public void SetFood(FoodId food)
 {
     this.food = FoodData.Find(food);
     foodField.SetFood(this.food);
 }