Exemplo n.º 1
0
        public ActionResult NewMouseAndKeyBoard(MouseAndKeyBoard mouseAndKeyBoard)
        {
            if (!ModelState.IsValid)
            {
                return(View("MouseAndKeyBoardForm", mouseAndKeyBoard));
            }

            _context.Items.Add(mouseAndKeyBoard);
            _context.SaveChanges();

            return(View("ItemForm"));
        }
Exemplo n.º 2
0
        public ActionResult New(string typeId)
        {
            if (typeId == "Default")
            {
                return(View("ItemForm"));
            }

            if (typeId == "Desktop")
            {
                Desktop desktop = new Desktop();
                return(View("DesktopForm", desktop));
            }

            if (typeId == "Camera")
            {
                Camera camera = new Camera();
                return(View("CameraForm", camera));
            }

            if (typeId == "CarryingBag")
            {
                CarryingBag carryingBag = new CarryingBag();
                return(View("CarryingBagForm", carryingBag));
            }

            if (typeId == "GameConsole")
            {
                GameConsole gameConsole = new GameConsole();
                return(View("GameConsoleForm", gameConsole));
            }

            if (typeId == "Laptop")
            {
                Laptop laptop = new Laptop();
                return(View("LaptopForm", laptop));
            }

            if (typeId == "MajorAppliance")
            {
                MajorAppliance majorAppliance = new MajorAppliance();
                return(View("MajorApplianceForm", majorAppliance));
            }

            if (typeId == "MouseAndKeyBoard")
            {
                MouseAndKeyBoard mouseAndKeyBoard = new MouseAndKeyBoard();
                return(View("MouseAndKeyBoardForm", mouseAndKeyBoard));
            }

            if (typeId == "Movie")
            {
                Movie movie = new Movie();
                return(View("MovieForm", movie));
            }

            if (typeId == "Software")
            {
                Software software = new Software();
                return(View("SoftwareForm", software));
            }

            if (typeId == "VideoGame")
            {
                VideoGame videoGame = new VideoGame();
                return(View("VideoGameForm", videoGame));
            }


            return(View("ItemForm"));
        }