public async Task <IActionResult> OnGetAsync(long?id) { if (id == null) { return(NotFound()); } Staff = await _context.Staff.FirstOrDefaultAsync(m => m.ID == id); Rank = await _context.Rank.FirstOrDefaultAsync(m => m.ID == Staff.RankID); Position = await _context.Position.FirstOrDefaultAsync(m => m.ID == Staff.PositionID); if (Staff == null) { return(NotFound()); } return(Page()); }
public async Task <IActionResult> OnGetAsync(long?id) { if (id == null) { return(NotFound()); } SelPosition = _context.Position.Select(p => new SelectListItem { Value = p.ID.ToString(), Text = p.NamePosition }).ToList(); SelRank = _context.Rank.Select(r => new SelectListItem { Value = r.ID.ToString(), Text = r.NameRank }).ToList(); SelGender = new List <SelectListItem> { new SelectListItem { Value = "Мужчина", Text = "Мужчина" }, new SelectListItem { Value = "Женщина", Text = "Женщина" } }; Staff = await _context.Staff.FirstOrDefaultAsync(m => m.ID == id); Rank = await _context.Rank.FirstOrDefaultAsync(m => m.ID == Staff.RankID); Position = await _context.Position.FirstOrDefaultAsync(m => m.ID == Staff.PositionID); if (Staff == null) { return(NotFound()); } return(Page()); }