Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("MsrID,AppTitle,MSRtitle,DateAdded,MSRNote,AssignedEmpID,AssignedAppID")] MSRTask mSRTask)
        {
            if (id != mSRTask.MsrID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(mSRTask);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MSRTaskExists(mSRTask.MsrID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AssignedEmp"] = new SelectList(_context.Analysts, "EmpID", "Fullname", mSRTask.AssignedEmpID);
            ViewData["AssignedApp"] = new SelectList(_context.Apps, "AppID", "AppName", mSRTask.AssignedAppID);
            return(View(mSRTask));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("MsrID,AppTitle,MSRtitle,DateAdded,MSRNote,AssignedEmpID,AssignedAppID")] MSRTask mSRTask)
        {
            if (ModelState.IsValid)
            {
                _context.Add(mSRTask);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AssignedEmp"] = new SelectList(_context.Employees, "EmpID", "Fullname", mSRTask.AssignedEmpID);
            ViewData["AssignedApp"] = new SelectList(_context.Apps, "AppID", "AppName", mSRTask.AssignedAppID);
            return(View(mSRTask));
        }