Beispiel #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] Categories categories)
        {
            if (id != categories.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(categories);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CategoriesExists(categories.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(categories));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Info,DepartmentId")] Workers workers)
        {
            if (id != workers.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(workers);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!WorkersExists(workers.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DepartmentId"] = new SelectList(_context.Departments, "Id", "Id", workers.DepartmentId);
            return(View(workers));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,OwnerId,MarketId")] OwnerMarket ownerMarket)
        {
            if (id != ownerMarket.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(ownerMarket);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OwnerMarketExists(ownerMarket.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                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));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,CategoryId")] Markets markets)
        {
            if (id != markets.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(markets);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MarketsExists(markets.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CategoryId"] = new SelectList(_context.Categories, "Id", "Name", markets.CategoryId);
            return(View(markets));
        }