Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("WorkerId,Surname,Name,MiddleName,Age,Sex,Adress,Phone,Passport,PositionId,TeamId")] Worker worker)
        {
            if (id != worker.WorkerId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(worker);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!WorkerExists(worker.WorkerId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TeamId"]     = new SelectList(_context.Teams, "TeamId", "TeamName", worker.TeamId);
            ViewData["PositionId"] = new SelectList(_context.Positions, "PositionId", "PositionName", worker.PositionId);
            return(View(worker));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("TeamId,TeamName")] Team team)
        {
            if (id != team.TeamId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(team);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TeamExists(team.TeamId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(team));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Edit(int id, [Bind("MaterialId,MaterialName,Description,Price")] Material material)
        {
            if (id != material.MaterialId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(material);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MaterialExists(material.MaterialId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(material));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Edit(int id, [Bind("CustomerId,Surname,Name,MiddleName,Adress,Phone,Passport")] Customer customer)
        {
            if (id != customer.CustomerId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(customer);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CustomerExists(customer.CustomerId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(customer));
        }
Exemplo n.º 5
0
        public async Task <IActionResult> Edit(int id, [Bind("OrderId,TeamId,CustomerId,TypeOfWorkId,Price,StartDate,FinishDate,ComplectionStatus,PayStatus")] Order order)
        {
            if (id != order.OrderId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(order);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OrderExists(order.OrderId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CustomerId"]   = new SelectList(_context.Customers, "CustomerId", "Surname", order.CustomerId);
            ViewData["TeamId"]       = new SelectList(_context.Teams, "TeamId", "TeamId", order.TeamId);
            ViewData["TypeOfWorkId"] = new SelectList(_context.TypeOfWorks, "TypeOfWorkId", "TypeOfWorkId", order.TypeOfWorkId);
            return(View(order));
        }
Exemplo n.º 6
0
        public async Task <IActionResult> Edit(int id, [Bind("TypeOfWorkId,WorkName,Description,Price")] TypeOfWork typeOfWork)
        {
            if (id != typeOfWork.TypeOfWorkId)
            {
                return(NotFound());
            }

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