Example #1
0
        public IActionResult Add3DFilament(ThreeDFilamentBindingModel threeDFilamentModel)
        {
            if (!ModelState.IsValid)
            {
                return(View(threeDFilamentModel));
            }

            this.threeDFilaments.Create(
                threeDFilamentModel.Make,
                threeDFilamentModel.Color,
                threeDFilamentModel.Price,
                threeDFilamentModel.ImageUrl,
                this.userManager.GetUserId(User));

            return(RedirectToAction("All3DFilaments"));
        }
Example #2
0
        public IActionResult Edit3DFilaments(int id, ThreeDFilamentBindingModel threeDFilamentModel)
        {
            if (!ModelState.IsValid)
            {
                return(View(threeDFilamentModel));
            }

            var threeDFilamentExists = this.threeDFilaments.Exists(id);

            if (!threeDFilamentExists)
            {
                return(NotFound());
            }

            this.threeDFilaments.EditFilaments(
                id,
                threeDFilamentModel.Make,
                threeDFilamentModel.Color,
                threeDFilamentModel.Price,
                threeDFilamentModel.ImageUrl);

            return(RedirectToAction("All3DFilaments"));
        }