public async Task <Machine> Update(Machine entity)
        {
            _context.Update(entity);
            await _context.SaveChangesAsync();

            return(entity);
        }
        public async Task <IActionResult> Edit(int id, [Bind("RouteID,LineID,BuggyID")] RouteModel routeModel)
        {
            if (id != routeModel.RouteID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(routeModel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RouteModelExists(routeModel.RouteID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BuggyID"] = new SelectList(_context.Buggies, "BuggyID", "BuggyID", routeModel.BuggyID);
            ViewData["LineID"]  = new SelectList(_context.Lines, "ID", "ID", routeModel.LineID);
            return(View(routeModel));
        }
        public async Task <T> Update(T entity)
        {
            _context.Update(entity);
            await _context.SaveChangesAsync();

            return(entity);
        }
Esempio n. 4
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Name")] LineModel lineModel)
        {
            if (id != lineModel.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(lineModel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LineModelExists(lineModel.ID))
                    {
                        TempData["Message"] = "NotFound";
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                TempData["Message"] = "Edit succesful";
                return(RedirectToAction(nameof(Index)));
            }
            return(View(lineModel));
        }
Esempio n. 5
0
        public async Task <Operation> Update(Operation entity)
        {
            _context.Update(entity);
            await _context.SaveChangesAsync();

            return(entity);
        }
        public async Task <ProductionLine> Update(ProductionLine entity)
        {
            _context.Update(entity);
            await _context.SaveChangesAsync();

            return(entity);
        }
Esempio n. 7
0
        public async Task <IActionResult> Edit(int id, [Bind("BuggyID,Name")] BuggyModel buggyModel)
        {
            if (id != buggyModel.BuggyID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(buggyModel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BuggyModelExists(buggyModel.BuggyID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(buggyModel));
        }