public async Task <IActionResult> Edit(int id, [Bind("MileStoneId,EmployeeSkillValueId,Date")] MileStone mileStone)
        {
            if (id != mileStone.MileStoneId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(mileStone);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MileStoneExists(mileStone.MileStoneId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmployeeSkillValueId"] = new SelectList(_context.EmployeeSkillValue, "EmployeeSkillValueId", "EmployeeSkillValueId", mileStone.EmployeeSkillValueId);
            return(View(mileStone));
        }
        public async Task <IActionResult> Edit(int id, [Bind("CommentId,AuthorId,MileStoneId,CommentValue")] Comment comment)
        {
            if (id != comment.CommentId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(comment);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CommentExists(comment.CommentId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MileStoneId"] = new SelectList(_context.MileStone, "MileStoneId", "MileStoneId", comment.MileStoneId);
            return(View(comment));
        }
示例#3
0
        public IActionResult ChangeRank(string login, int?rankid)
        {
            if (login == null || rankid == null)
            {
                return(NotFound());
            }
            var employee = _context.Employee.Include(e => e.EmployeeAccount).Where(m => m.EmployeeAccount.Login == login).FirstOrDefault();

            if (employee == null)
            {
                return(NotFound());
            }
            employee.RankId = rankid.Value;

            _context.Update(employee);
            _context.SaveChangesAsync();
            return(RedirectToAction("Info", new { login = login }));
        }