Beispiel #1
0
        public async Task <IActionResult> Create([Bind("SectorId,SectorName,Description")] Sector sector)
        {
            if (ModelState.IsValid)
            {
                _context.Add(sector);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(sector));
        }
        public async Task <IActionResult> Create([Bind("ManagerId,ManagerName,Email")] Manager manager)
        {
            if (ModelState.IsValid)
            {
                _context.Add(manager);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(manager));
        }
Beispiel #3
0
        public async Task <IActionResult> Create([Bind("WarehouseId,Area,Location,Descriptiom,Owner,NumberOfWorkers,SectorId,ManagerId")] Warehouse warehouse)
        {
            if (ModelState.IsValid)
            {
                _context.Add(warehouse);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ManagerId"] = new SelectList(_context.Set <Manager>(), "ManagerId", "ManagerId", warehouse.ManagerId);
            ViewData["SectorId"]  = new SelectList(_context.Set <Sector>(), "SectorId", "SectorId", warehouse.SectorId);
            return(View(warehouse));
        }