public ActionResult Update(int id)
        {
            var house     = HousesManager.GetByID(id);
            var viewModel = new HouseUpdateResponseViewModel(house);

            return(View("~/Views/Houses/AddOrUpdate.cshtml", viewModel));
        }
Ejemplo n.º 2
0
 void Awake()
 {
     if (Instance == null)
     {
         Instance = gameObject.GetComponent <HousesManager>();
     }
 }
        public ActionResult Details(int id)
        {
            var house = HousesManager.GetByID(id);

            if (house == null)
            {
                return(RedirectToAction("Index"));
            }

            var viewModel = new HouseDetailsViewModel(house);

            return(View(viewModel));
        }
        public ActionResult Create(HouseUpdateRequestViewModel requestModel)
        {
            var house = new House();

            requestModel.UpdateHouseModel(house);

            bool success = HousesManager.Save(house);

            var viewModel = new HouseUpdateResponseViewModel(house);

            viewModel.UpdateSuccess = success;

            return(RedirectToAction("Details", new { id = house.ID }));
        }
        public ActionResult Update(int id, HouseUpdateRequestViewModel requestModel)
        {
            var house = HousesManager.GetByID(id);

            requestModel.UpdateHouseModel(house);

            bool success = HousesManager.Save(house);

            var viewModel = new HouseUpdateResponseViewModel(house);

            viewModel.UpdateSuccess = success;

            return(View("~/Views/Houses/AddOrUpdate.cshtml", viewModel));
        }
        public ActionResult Index()
        {
            var houses = HousesManager.GetAll();

            return(View(houses));
        }
        /// <summary>
        /// This page should show a list of all houses in which all kids are nice and receiving presents
        /// </summary>
        /// <returns></returns>
        public ActionResult GoodHouses()
        {
            var goodHouses = HousesManager.GetHousesWithOnlyNiceKids();

            return(View(goodHouses));
        }