public async Task <IActionResult> Edit(int id, [Bind("Id,Product,Category_Type")] Category_Detail category_Detail) { if (id != category_Detail.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(category_Detail); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!Category_DetailExists(category_Detail.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(category_Detail)); }
public async Task <IActionResult> Create([Bind("Id,Product,Category_Type")] Category_Detail category_Detail) { if (ModelState.IsValid) { _context.Add(category_Detail); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(category_Detail)); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Category_Detail = await _context.Category_Detail.FirstOrDefaultAsync(m => m.Id == id); if (Category_Detail == null) { return(NotFound()); } return(Page()); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Category_Detail = await _context.Category_Detail.FindAsync(id); if (Category_Detail != null) { _context.Category_Detail.Remove(Category_Detail); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }