Example #1
0
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,NameTask,StartDate,EndDate,StateTask")] Tasks tasks)
        {
            if (id != tasks.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tasks);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TasksExists(tasks.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(tasks));
        }
Example #2
0
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,FIO,Position,State,TaskId")] Worker worker)
        {
            if (id != worker.Id)
            {
                return(NotFound());
            }

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