Ejemplo n.º 1
0
        public IActionResult Edit(string id, [Bind("Id,UserName,Position")] Employee employee)
        {
            if (id != employee.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(employee);
                    _context.SaveChanges();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EmployeeExists(employee.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(employee));
        }
Ejemplo n.º 2
0
        public IActionResult Edit(string id, [Bind("Id,ProjectTitle,Budget,CompletionDate")] Project project)
        {
            if (id != project.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(project);
                    _context.SaveChanges();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProjectExists(project.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(project));
        }
Ejemplo n.º 3
0
        public IActionResult Edit(string id, [Bind("Id,TaskTitle,EstimatedNumberOfDays,ActualNumberOfDays,ProjectId,EmployeeId")] ProjectTask projectTask)
        {
            if (id != projectTask.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(projectTask);
                    _context.SaveChanges();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProjectTaskExists(projectTask.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmployeeId"] = new SelectList(_context.Employee, "Id", "UserName", projectTask.EmployeeId);
            ViewData["ProjectId"]  = new SelectList(_context.Project, "Id", "ProjectTitle", projectTask.ProjectId);
            return(View(projectTask));
        }