Exemple #1
0
        private async void TypePick(object sender, EventArgs e)
        {
            TypeOfFood type = (TypeOfFood)((ItemTappedEventArgs)e).Item;

            TypesListView.SelectedItem = null;
            await Navigation.PushAsync(new FoodPickPage(type));
        }
Exemple #2
0
 public void Feed(TypeOfFood food)
 {
     if (_hunger < 25)
     {
         Console.WriteLine($"{Name} is not hungry at all, stop contributing to childhood obesity");
         return;
     }
     if (food == TypeOfFood.Snack)
     {
         Console.WriteLine($"{Name} loved those fruit snacks!");
         _hunger -= _snack;
         if (_hunger < 0)
         {
             _hunger = 0;
         }
     }
     else if (food == TypeOfFood.Meal)
     {
         Console.WriteLine($"{Name} insisted on mini corn dogs...again.");
         _hunger -= _meal;
         if (_hunger < 0)
         {
             _hunger = 0;
         }
     }
 }
Exemple #3
0
 public BaseFoodViewModel(TypeOfFood type)
 {
     user                = JsonConvert.DeserializeObject <ApplicationUser>(Preferences.Get("User", "default_value"));
     FoodType            = type;
     AddCommand          = new Command(OnAdd);
     SelectedChangedFood = new Command(OnSelectedFood);
     Foods               = new ObservableCollection <Food>();
     GetFoods(FoodType);
 }
        public FoodPickPage(TypeOfFood type)
        {
            TypeTitle = type.TypeName;
            FoodList  = type.ListOfFood;

            InitializeComponent();

            this.BindingContext = this;
        }
 public TypeOfFoodPage(TypeOfFood type)
 {
     TypeTitle = type.TypeName;
     FoodList  = new List <Food>();
     for (int i = 0; i < type.ListOfFood.Count; i++)
     {
         FoodList.Add(type.ListOfFood[i]);
     }
     InitializeComponent();
     this.BindingContext = this;
 }
Exemple #6
0
        public ActionResult EditTypeOfFood(TypeOfFood typeOfFoodToUpdate)
        {
            TypeOfFood.Validate(typeOfFoodToUpdate, ModelState);

            if (!ModelState.IsValid)
            {
                return(View(typeOfFoodToUpdate));
            }

            _unitOfWork.TypeOfFoodRepository.Update(typeOfFoodToUpdate);
            _unitOfWork.Save();

            return(RedirectToAction("TypeOfFoods"));
        }
Exemple #7
0
        public ActionResult AddTypeOfFood(TypeOfFood newTypeOfFood)
        {
            TypeOfFood.Validate(newTypeOfFood, ModelState);

            if (!ModelState.IsValid)
            {
                return(View(newTypeOfFood));
            }

            _unitOfWork.TypeOfFoodRepository.Insert(newTypeOfFood);
            _unitOfWork.Save();

            return(RedirectToAction("TypeOfFoods"));
        }
Exemple #8
0
        protected Animal(TypeOfFood canBeEatenAs, TypeOfFood canEat, TypeOfConsumption typeOfConsumption)
        {
            CanBeEatenAs      = canBeEatenAs;
            CanEat            = canEat;
            TypeOfConsumption = typeOfConsumption;

            if (_random.NextDouble() > 0.5)
            {
                Sex = Sex.Female;
            }
            else
            {
                Sex = Sex.Male;
            }
        }
Exemple #9
0
        public ActionResult AddHotel(HotelViewModel hotelViewModel)
        {
            Hotel.Validate(hotelViewModel.Hotel, ModelState);

            if (ModelState.IsValid)
            {
                TypeOfFood typeOfFood = _unitOfWork.TypeOfFoodRepository.Find(hotelViewModel.SelectedTypeOfFoodId);
                hotelViewModel.Hotel.TypeOfFood = typeOfFood;

                _unitOfWork.HotelRepository.Insert(hotelViewModel.Hotel);
                _unitOfWork.Save();

                return(RedirectToAction("Hotels"));
            }

            hotelViewModel.TypeOfFoods = GetHotelsAsSelectList();
            return(View(hotelViewModel));
        }
Exemple #10
0
        public async void GetFoods(TypeOfFood foodtype)
        {
            RestService restSevice    = new RestService();
            FoodManager myFoodManager = new FoodManager(restSevice);
            List <Food> listFoods     = await myFoodManager.GetFoodsAsync();

            string              connectionString  = Constants.connectionString;
            BlobServiceClient   blobServiceClient = new BlobServiceClient(connectionString);
            string              containerName     = "foodpicsblobs";
            BlobContainerClient containerClient   = blobServiceClient.GetBlobContainerClient(containerName);

            foreach (var item in listFoods)
            {
                if (item.FoodType != foodtype)
                {
                    continue;
                }
                item.SetUserLoc(new Location(user.UserLocLatitude, user.UserLocLongitude));
                BlobClient blobClient = containerClient.GetBlobClient(item.ImageUrl);
                item.ImageSource = ImageSource.FromStream(() => { var stream = blobClient.OpenRead(); return(stream); });
                Foods.Add(item);
            }
        }
 public FromStoreViewModel(TypeOfFood type) : base(type)
 {
 }
Exemple #12
0
 public Predator(int id, string name, double countFood, TypeOfFood type) : base(id, name, countFood, type)
 {
 }
 protected Plant(TypeOfFood canBeEatenAs)
 {
     CanBeEatenAs = canBeEatenAs;
 }
 public HomeMadeViewModel(TypeOfFood type) : base(type)
 {
 }
 public Food(string productid, string productname, double productselllingprice, double producttax, int productquantity, DateTime productpurchasedate, TypeOfFood typeoffood) : base(productid, productname, productselllingprice, producttax, productquantity, productpurchasedate)
 {
     TypeOfFoods = typeoffood;
 }
Exemple #16
0
 public FlightPassenger(Passport passport, uint baggageWeight, TypeOfFood typeOfFood)
 {
     Passport      = passport;
     BaggageWeight = baggageWeight;
     TypeOfFood    = typeOfFood;
 }
Exemple #17
0
 void CopyWithoutRemainAmount(Food food)
 {
     //remainFoodAmount = food.remainFoodAmount;
     type          = food.type;
     perferedLevel = food.perferedLevel;
 }
Exemple #18
0
 public Animal(int id, string name, double countFood, TypeOfFood type)
 {
     Id = id; Name = name; CountFood = countFood; Type = type;
 }
Exemple #19
0
 public Herbivores(int id, string name, double countFood, TypeOfFood type) : base(id, name, countFood, type)
 {
 }
Exemple #20
0
 public void Init(TypeOfFood type)
 {
     this.type        = type;
     remainFoodAmount = 8;
 }