public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } AwardNotice = await _context.AwardNotice .Include(a => a.SalesPerson).FirstOrDefaultAsync(m => m.Id == id); if (AwardNotice == null) { return(NotFound()); } return(Page()); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } AwardNotice = await _context.AwardNotice.FindAsync(id); if (AwardNotice != null) { _context.AwardNotice.Remove(AwardNotice); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } AwardNotice = await _context.AwardNotice .Include(a => a.SalesPerson).FirstOrDefaultAsync(m => m.Id == id); if (AwardNotice == null) { return(NotFound()); } ViewData["SalesPersonId"] = new SelectList(_context.SalesPerson, "Id", "FirstName"); return(Page()); }
public IActionResult OnPost() { SalesPerson = _context.SalesPerson.Find(AwardNoticeForm.SalesPersonId); if (!ModelState.IsValid) { return(Page()); } AwardNotice an = new AwardNotice(); an.SalesPersonId = AwardNoticeForm.SalesPersonId; an.EntryDate = AwardNoticeForm.EntryDate; an.isNotice = AwardNoticeForm.isAward; _context.AwardNotice.Add(an); _context.SaveChanges(); return(RedirectToPage("/AwardsNotices/Details", new { Id = an.Id })); }