public async Task <IActionResult> Create([Bind("UserID,FirstName,LastName,BirthDate,Gender,Email,Password,City,Street,PhoneNumber,Role")] User user)
        {
            if (ModelState.IsValid)
            {
                _context.Add(user);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index", "Home", new { }));
            }
            return(View(user));
        }
        public async Task <IActionResult> Create([Bind("ID,Name,Image,FoundedDate,Specialty")] Publisher publisher)
        {
            if (ModelState.IsValid)
            {
                _context.Add(publisher);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(publisher));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("StoreID,StoreName,StoreCity,StoreStreet,StoresPhoneNumber,Latitude,Longitude")] Store store)
        {
            if (ModelState.IsValid)
            {
                _context.Add(store);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(store));
        }
        public async Task <IActionResult> Create([Bind("ID,Title,Description,Genre,Price,Image,PublisherID,IsMultiplayer,ReleaseDate")] Game game)
        {
            if (ModelState.IsValid)
            {
                _context.Add(game);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PublisherID"] = new SelectList(_context.Set <Publisher>(), "ID", "Name", game.PublisherID);
            return(View(game));
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> Create([Bind("ID,orderId,gameId")] OrderItems orderItems)
        {
            if (ModelState.IsValid)
            {
                _context.Add(orderItems);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["gameId"]  = new SelectList(_context.Game, "ID", "Description", orderItems.gameId);
            ViewData["orderId"] = new SelectList(_context.Order, "OrderID", "OrderID", orderItems.orderId);
            return(View(orderItems));
        }
        public async Task <IActionResult> Create([Bind("OrderID,CustomerId,StoreID,OrderDate")] Order order)
        {
            if (ModelState.IsValid)
            {
                _context.Add(order);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CustomerId"] = new SelectList(_context.User, "UserID", "Email", order.CustomerId);
            ViewData["StoreID"]    = new SelectList(_context.Store, "StoreID", "StoreCity", order.StoreID);
            return(View(order));
        }