Exemplo n.º 1
0
        public async Task <IActionResult> Edit(long id, [Bind("AncestorTaskGroupId,DescendantTaskGroupId,DependencyType")] TaskGroupDependency taskGroupDependency)
        {
            if (id != taskGroupDependency.AncestorTaskGroupId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(taskGroupDependency);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TaskGroupDependencyExists(taskGroupDependency.AncestorTaskGroupId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(IndexDataTable)));
            }
            ViewData["AncestorTaskGroupId"]   = new SelectList(_context.TaskGroup.OrderBy(x => x.TaskGroupName), "TaskGroupId", "TaskGroupName", taskGroupDependency.AncestorTaskGroupId);
            ViewData["DescendantTaskGroupId"] = new SelectList(_context.TaskGroup.OrderBy(x => x.TaskGroupName), "TaskGroupId", "TaskGroupName", taskGroupDependency.DescendantTaskGroupId);
            return(View(taskGroupDependency));
        }
        // GET: TaskGroupDependency/Create
        public IActionResult Create()
        {
            ViewData["AncestorTaskGroupId"]   = new SelectList(_context.TaskGroup.OrderBy(x => x.TaskGroupName), "TaskGroupId", "TaskGroupName");
            ViewData["DescendantTaskGroupId"] = new SelectList(_context.TaskGroup.OrderBy(x => x.TaskGroupName), "TaskGroupId", "TaskGroupName");
            TaskGroupDependency taskGroupDependency = new TaskGroupDependency();

            return(View(taskGroupDependency));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("AncestorTaskGroupId,DescendantTaskGroupId,DependencyType")] TaskGroupDependency taskGroupDependency)
        {
            if (ModelState.IsValid)
            {
                _context.Add(taskGroupDependency);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(IndexDataTable)));
            }
            ViewData["AncestorTaskGroupId"]   = new SelectList(_context.TaskGroup.OrderBy(x => x.TaskGroupName), "TaskGroupId", "TaskGroupName", taskGroupDependency.AncestorTaskGroupId);
            ViewData["DescendantTaskGroupId"] = new SelectList(_context.TaskGroup.OrderBy(x => x.TaskGroupName), "TaskGroupId", "TaskGroupName", taskGroupDependency.DescendantTaskGroupId);
            return(View(taskGroupDependency));
        }
 public async Task <IActionResult> EditPlus([Bind("AncestorTaskGroupId,DescendantTaskGroupId,DependencyType")] TaskGroupDependency taskGroupDependency)
 {
     if (ModelState.IsValid)
     {
         try
         {
             _context.Update(taskGroupDependency);
             await _context.SaveChangesAsync();
         }
         catch (DbUpdateConcurrencyException)
         {
             if (!TaskGroupDependencyExists(taskGroupDependency.AncestorTaskGroupId, taskGroupDependency.DescendantTaskGroupId))
             {
                 return(NotFound());
             }
             else
             {
                 throw;
             }
         }
         return(RedirectToAction(nameof(IndexDataTable)));
     }
     return(View("Edit", taskGroupDependency));
 }