Example #1
0
        public async Task <IActionResult> Edit(int id, [Bind("SectorId,SectorName,Description")] Sector sector)
        {
            if (id != sector.SectorId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(sector);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SectorExists(sector.SectorId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(sector));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ManagerId,ManagerName,Email")] Manager manager)
        {
            if (id != manager.ManagerId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(manager);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ManagerExists(manager.ManagerId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(manager));
        }
Example #3
0
        public async Task <IActionResult> Edit(int id, [Bind("WarehouseId,Area,Location,Descriptiom,Owner,NumberOfWorkers,SectorId,ManagerId")] Warehouse warehouse)
        {
            if (id != warehouse.WarehouseId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(warehouse);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!WarehouseExists(warehouse.WarehouseId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                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));
        }