Пример #1
0
        public ActionResult Decrease()
        {
            Tamagotchi.PassTime();
            List <Tamagotchi> allTamagotchis = Tamagotchi.GetAll();

            return(View("Index", allTamagotchis));
        }
        public ActionResult Show()
        {
            Tamagotchi        newToy  = new Tamagotchi(Request.Form["new-name"]);
            List <Tamagotchi> allToys = Tamagotchi.GetAll();

            return(View("Show", allToys));
        }
Пример #3
0
        public HomeModule()
        {
            Get["/"] = _ => {
                return(View ["create_tamo.cshtml"]);
            };
            Post["/tamo_list"] = _ => {
                // List<Tamagotchi> zombitamo = new List <string,object>();
                Tamagotchi        myownTamo = new Tamagotchi(Request.Form["create"]);
                List <Tamagotchi> TamoList  = Tamagotchi.GetAll();


                // if (myownTamo.Zombigochi()) {
                //   Tamagotchi myownTamo = new Tamagotchi (myownTamo);
                //   zombitamo.Add("ResultingTamo", myownTamo);
                // }
                return(View["tamo_list.cshtml", TamoList]);
            };

            Post["/new_tamo_list"] = _ => {
                Tamagotchi newTamo = new Tamagotchi(Request.Form["John"]);
                newTamo.Feed();
                List <Tamagotchi> TamoList = Tamagotchi.GetAll();
                return(View["tamo_list.cshtml", newTamo]);
            };
        }
Пример #4
0
        public ActionResult Time()
        {
            Tamagotchi.TimePass();
            List <Tamagotchi> allTama = Tamagotchi.GetAll();

            return(View("Index", allTama));
        }
Пример #5
0
        public ActionResult Feed()
        {
            Tamagotchi.FeedTama();
            List <Tamagotchi> allTama = Tamagotchi.GetAll();

            return(View("Index", allTama));
        }
Пример #6
0
        public ActionResult ClearAll()
        {
            Tamagotchi.ClearAll();
            List <Tamagotchi> allTamagotchis = Tamagotchi.GetAll();

            return(View("../Home/Index", allTamagotchis));
        }
Пример #7
0
        public ActionResult Nap()
        {
            Tamagotchi.TamaRest();
            List <Tamagotchi> allTama = Tamagotchi.GetAll();

            return(View("Index", allTama));
        }
        public ActionResult Show(int id)
        {
            List <Tamagotchi> allToys = Tamagotchi.GetAll();
            int find = id - 1;

            return(View("ShowID", allToys[find]));
        }
Пример #9
0
        public ActionResult DeleteAll()
        {
            Tamagotchi.ClearAll();
            List <Tamagotchi> allTamagotchis = Tamagotchi.GetAll();

            return(View("Index", allTamagotchis));
        }
Пример #10
0
        public ActionResult ChangeEnergy(int id)
        {
            Tamagotchi foundTamagotchi = Tamagotchi.Find(id);

            foundTamagotchi.SleepLevel += 6;

            List <Tamagotchi> listTamagotchi = Tamagotchi.GetAll();

            foreach (Tamagotchi tamagotchi in listTamagotchi)
            {
                tamagotchi.FoodLevel      -= 1;
                tamagotchi.AttentionLevel -= 1;
                tamagotchi.SleepLevel     -= 1;
            }
            List <Tamagotchi> deadList = new List <Tamagotchi> {
            };

            foreach (Tamagotchi tamagotchi in listTamagotchi)
            {
                if (tamagotchi.FoodLevel == 0 | tamagotchi.AttentionLevel == 0 | tamagotchi.SleepLevel == 0)
                {
                    deadList.Add(tamagotchi);
                    return(View("Cemetary", deadList));
                }
            }

            return(View("Show", foundTamagotchi));
        }
Пример #11
0
        public ActionResult Create(string name)
        {
            Tamagotchi        tama           = new Tamagotchi(name);
            List <Tamagotchi> allTamagotchis = Tamagotchi.GetAll();

            return(View("Index", allTamagotchis));
        }
        public ActionResult Index3(int id)
        {
            Tamagotchi.Find(id).GiveHappiness();
            List <Tamagotchi> allTamagotchies = Tamagotchi.GetAll();

            return(View("Index", allTamagotchies));
        }
        public ActionResult Create()
        {
            Tamagotchi        newTamagotchi = new Tamagotchi(Request.Form["new-name"]);
            List <Tamagotchi> allTamas      = Tamagotchi.GetAll();

            return(View("Index", allTamas));
        }
Пример #14
0
        public ActionResult DeleteLife(int id)
        {
            Tamagotchi.ClearLife(id);
            List <Tamagotchi> allTamagotchis = Tamagotchi.GetAll();

            return(View("Delete", allTamagotchis));
        }
Пример #15
0
 public ActionResult FastForward()
 {
     foreach (Tamagotchi tamagotchi in Tamagotchi.GetAll())
     {
         tamagotchi.PassTime(15);
     }
     return(Redirect("/"));
 }
Пример #16
0
        public ActionResult Create()
        {
            string            name           = Request.Form["name"];
            Tamagotchi        tama           = new Tamagotchi(name);
            List <Tamagotchi> allTamagotchis = Tamagotchi.GetAll();

            return(View("../Home/Index", allTamagotchis));
        }
Пример #17
0
        public ActionResult SleepID(int id)
        {
            Tamagotchi tamagotchi = Tamagotchi.Find(id);

            tamagotchi.SetSleep(2);
            List <Tamagotchi> allTamagotchis = Tamagotchi.GetAll();

            return(View("Index", allTamagotchis));
        }
Пример #18
0
        public ActionResult SleepID(int id)
        {
            Tamagotchi tamagotchi = Tamagotchi.Find(id);

            tamagotchi.SetSleep(2);
            List <Tamagotchi> allTamagotchis = Tamagotchi.GetAll();

            return(RedirectToAction("Index"));
        }
Пример #19
0
        public ActionResult Create()
        {
            Tamagotchi newTamagotchi = new Tamagotchi(Request.Form["name"], 1, 1, 1);

            newTamagotchi.Save();
            List <Tamagotchi> allTamagotchis = Tamagotchi.GetAll();

            return(RedirectToAction("Index"));
        }
Пример #20
0
        public ActionResult Sleep()
        {
            foreach (Tamagotchi life in Tamagotchi.GetAll())
            {
                life.SetSleep(1);
            }
            List <Tamagotchi> allTamagotchis = Tamagotchi.GetAll();

            return(View("Index", allTamagotchis));
        }
Пример #21
0
        public ActionResult Index()
        {
            Dictionary <string, Object> _model = new Dictionary <string, Object>()
            {
            };

            _model.Add("TamagotchiList", Tamagotchi.GetAll());
            _model.Add("SelectedTamagotchi", Tamagotchi.CurrentlySelected);
            return(View(_model));
        }
Пример #22
0
        public ActionResult Sleep()
        {
            foreach (Tamagotchi life in Tamagotchi.GetAll())
            {
                life.SetSleep(1);
            }
            List <Tamagotchi> allTamagotchis = Tamagotchi.GetAll();

            return(RedirectToAction("Index"));
        }
        public ActionResult Decrease()
        {
            List <Tamagotchi> allTamagotchies = Tamagotchi.GetAll();

            foreach (Tamagotchi tama in allTamagotchies)
            {
                tama.Timepass();
            }
            return(View("Index", allTamagotchies));
        }
        public void GetAll_GetAllTamagotchis_List()
        {
            Tamagotchi        tamagotchi  = new Tamagotchi("cutiePie");
            Tamagotchi        tamagotchi2 = new Tamagotchi("ugly");
            List <Tamagotchi> expected    = new List <Tamagotchi> {
                tamagotchi, tamagotchi2
            };
            List <Tamagotchi> result = Tamagotchi.GetAll();

            CollectionAssert.AreEqual(expected, result);
        }
Пример #25
0
        public ActionResult Decrease()
        {
            List <Tamagotchi> allTamagotchis = Tamagotchi.GetAll();

            foreach (Tamagotchi tama in allTamagotchis)
            {
                tama.SetFood(tama.GetFood() - 1);
                tama.SetSleep(tama.GetSleep() - 1);
                tama.SetHappiness(tama.GetHappiness() - 1);
            }
            return(View("../Home/Index", allTamagotchis));
        }
        public ActionResult Pass()
        {
            List <Tamagotchi> allTamagotchis = Tamagotchi.GetAll();

            foreach (Tamagotchi newTamagotchi in allTamagotchis)
            {
                newTamagotchi.food      -= 5;
                newTamagotchi.attention -= 5;
                newTamagotchi.rest      -= 5;
            }

            return(View("Index", allTamagotchis));
        }
Пример #27
0
        public ActionResult Sleep(string id)
        {
            int petId = int.Parse(id);

            Tamagotchi.GetAll()[petId - 1].SetRest(Tamagotchi.GetAll()[petId - 1].GetRest() + 10);
            foreach (Tamagotchi pet in Tamagotchi.GetAll())
            {
                pet.SetFood(pet.GetFood() - 2);
                pet.SetAttention(pet.GetAttention() - 2);
                pet.SetRest(pet.GetRest() - 2);
            }
            return(RedirectToAction("Detail", new { id = petId }));
        }
Пример #28
0
        public ActionResult Create()
        {
            string stringRest      = Request.Form["new-rest"];
            string stringAttention = Request.Form["new-attention"];
            string stringFood      = Request.Form["new-food"];
            int    rest            = int.Parse(stringRest);
            int    attention       = int.Parse(stringAttention);
            int    food            = int.Parse(stringFood);

            Tamagotchi        newTamagotchi = new Tamagotchi(Request.Form["new-tamagotchi"], food, attention, rest);
            List <Tamagotchi> allTama       = Tamagotchi.GetAll();

            return(View("Index", allTama));
        }
Пример #29
0
        public ActionResult ChangeFood(int id)
        {
            List <Tamagotchi> listTamagotchi = Tamagotchi.GetAll();

            foreach (Tamagotchi tamagotchi in listTamagotchi)
            {
                tamagotchi.FoodLevel      -= 1;
                tamagotchi.AttentionLevel -= 1;
                tamagotchi.SleepLevel     -= 1;
            }
            Tamagotchi foundTamagotchi = Tamagotchi.Find(id);

            foundTamagotchi.FoodLevel += 6;
            return(View("Show", foundTamagotchi));
        }
        public ActionResult Index()
        {
            List <Tamagotchi> allTamas = Tamagotchi.GetAll();

            return(View(allTamas));
        }