public static DTOCoat ToDTO(this CoatModel model) { return(new DTOCoat() { Id = model.Id, Name = model.Name }); }
public async Task <IActionResult> OnGetAsync(Guid?id) { if (id == null) { return(NotFound()); } CoatModel = await _context.CoatModel .Include(c => c.Coat).FirstOrDefaultAsync(m => m.Id == id); if (CoatModel == null) { return(NotFound()); } return(Page()); }
public async Task <IActionResult> OnPostAsync(Guid?id) { if (id == null) { return(NotFound()); } CoatModel = await _context.CoatModel.FindAsync(id); if (CoatModel != null) { _context.CoatModel.Remove(CoatModel); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnGetAsync(Guid?id) { if (id == null) { return(NotFound()); } CoatModel = await _context.CoatModel .Include(c => c.Coat).FirstOrDefaultAsync(m => m.Id == id); if (CoatModel == null) { return(NotFound()); } ViewData["CoatId"] = new SelectList(_context.Coat, "Id", "Brand"); return(Page()); }