public async Task <IActionResult> SuaChuDe(int id, ThemChuDeViewModel model) { var chude = await context.ChuDe.FindAsync(id); chude.TenChuDe = model.TenChuDe; context.ChuDe.Update(chude); await context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); }
public async Task <IActionResult> ThemChuDe(ThemChuDeViewModel model) { var chude = new ChuDe { TenChuDe = model.TenChuDe, }; await context.ChuDe.AddAsync(chude); await context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); }