public async Task <IActionResult> SuaNhaXuatBan(int id, ThemNhaXuatBanViewModel model) { var nxb = await context.NhaXuatBan.FindAsync(id); nxb.TenNhaXuatBan = model.TenNhaXuatBan; nxb.SoDienThoai = model.SoDienThoai; context.NhaXuatBan.Update(nxb); await context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); }
public async Task <IActionResult> ThemNhaXuatBan(ThemNhaXuatBanViewModel model) { var nxb = new NhaXuatBan { TenNhaXuatBan = model.TenNhaXuatBan, SoDienThoai = model.SoDienThoai, }; await context.NhaXuatBan.AddAsync(nxb); await context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); }