Beispiel #1
0
        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)));
        }
Beispiel #2
0
        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)));
        }