Exemple #1
0
        public IActionResult EditTechnology(TechnologiesViewModel techListModel)
        {
            if (ModelState.IsValid)
            {
                var newTechnology = new Technology()
                {
                    Name = techListModel.ViewModel.Name, Version = techListModel.ViewModel.Version
                };

                //this._technologyRepository.dele(newTechnology);

                ModelState.Clear();
            }
            return(Technologies());
        }
Exemple #2
0
        public IActionResult Technologies()
        {
            var technologies = this._technologyRepository.GetAllTechnologies();

            var technologyListModel = new List <TechnologyViewModel>();

            foreach (var technology in technologies)
            {
                technologyListModel.Add(new TechnologyViewModel()
                {
                    Name = technology.Name, Version = technology.Version
                });
            }

            var technologiesListModel = new TechnologiesViewModel()
            {
                ViewModels = technologyListModel,
            };

            return(View(technologiesListModel));
        }
        // GET: Planet/Technologies
        public ActionResult Index()
        {
            var userId = User != null ? User.Identity.GetUserId() : "";

            var rCLevel = this.buildingsService.GetPlayerBuildings(userId).ResearchCentreLevel;
            var technologies = this.techService.GetPlayerTechnologies(userId);

            var vM = new TechnologiesViewModel(rCLevel, technologies)
            {
                FasterConstruction = new TechnologyViewModel(technologies.FasterConstructionLevel, this.logic.Technologies.FasterConstruction),
                MoreResources = new TechnologyViewModel(technologies.MoreResourcesLevel, this.logic.Technologies.MoreResources),
                ArmoredFleet = new TechnologyViewModel(technologies.ArmoredFleetLevel, this.logic.Technologies.ArmoredFleet),
                CheaperFleet = new TechnologyViewModel(technologies.CheaperFleetLevel, this.logic.Technologies.CheaperFleet),
                LargerFleet = new TechnologyViewModel(technologies.LargerFleetLevel, this.logic.Technologies.LargerFleet)
            };

            var reqRes = this.playerService.GetPlayerResources(userId);
            ViewBag.Energy = reqRes.Energy;
            ViewBag.Crystal = reqRes.Crystal;
            ViewBag.Metal = reqRes.Metal;

            return View(vM);
        }