Exemple #1
0
        public ActionResult Edit(PartCreateModel inputModel)
        {
            if (!ModelState.IsValid)
            {
                return(View(inputModel));
            }

            var part = this.mapper.Map <Part>(inputModel);

            part.Id = (int)inputModel.PartId;
            this.partsService.EditPart(part);

            return(RedirectToAction(nameof(Menu)));
        }
Exemple #2
0
        public ActionResult Create(PartCreateModel inputModel)
        {
            if (!ModelState.IsValid)
            {
                return(this.View(inputModel));
            }

            var part = this.mapper.Map <Part>(inputModel);

            part = this.partsService.AddPart(part);
            var player = this.playersService.GetUserByUsername("OfficialStore");

            this.playersService.AddPartToInventory(part.Id, player.Id);

            return(Redirect("Menu"));
        }