Exemplo n.º 1
0
        public async Task <IActionResult> Create([Bind("Id,Name")] Categories categories)
        {
            if (ModelState.IsValid)
            {
                _context.Add(categories);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(categories));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("Id,Name,CategoryId")] Markets markets)
        {
            if (ModelState.IsValid)
            {
                _context.Add(markets);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CategoryId"] = new SelectList(_context.Categories, "Id", "Name", markets.CategoryId);
            return(View(markets));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("Id,Name,Info,DepartmentId")] Workers workers)
        {
            if (ModelState.IsValid)
            {
                _context.Add(workers);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DepartmentId"] = new SelectList(_context.Departments, "Id", "Id", workers.DepartmentId);
            return(View(workers));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Create([Bind("Id,MarketId")] Departments departments)
        {
            if (ModelState.IsValid)
            {
                _context.Add(departments);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MarketId"] = new SelectList(_context.Markets, "Id", "Name", departments.MarketId);
            return(View(departments));
        }
Exemplo n.º 5
0
        public async Task <IActionResult> Create([Bind("Id,OwnerId,MarketId")] OwnerMarket ownerMarket)
        {
            if (ModelState.IsValid)
            {
                _context.Add(ownerMarket);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MarketId"] = new SelectList(_context.Markets, "Id", "Name", ownerMarket.MarketId);
            ViewData["OwnerId"]  = new SelectList(_context.Owners, "Id", "Name", ownerMarket.OwnerId);
            return(View(ownerMarket));
        }