コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("ResourceTitle,ResourcePlanned,ResourceReal,RessourceDeviation,FunctionId,PhaseActivityId,Id")] PersonnelResource personnelResource)
        {
            if (id != personnelResource.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(personnelResource);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PersonnelResourceExists(personnelResource.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["FunctionId"]      = new SelectList(_context.Functions, "Id", "FunctionTyp", personnelResource.FunctionId);
            ViewData["PhaseActivityId"] = new SelectList(_context.PhasesActivities, "Id", "PhaseActivityName", personnelResource.PhaseActivityId);
            return(View(personnelResource));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("ResourceTitle,ResourcePlanned,ResourceReal,RessourceDeviation,FunctionId,PhaseActivityId,Id")] PersonnelResource personnelResource)
        {
            if (ModelState.IsValid)
            {
                _context.Add(personnelResource);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["FunctionId"]      = new SelectList(_context.Functions, "Id", "FunctionTyp", personnelResource.FunctionId);
            ViewData["PhaseActivityId"] = new SelectList(_context.PhasesActivities, "Id", "PhaseActivityName", personnelResource.PhaseActivityId);
            return(View(personnelResource));
        }