public async Task <T> CreateAsync(T entity) { _context.Add(entity); await _context.SaveChangesAsync(); return(entity); }
public async Task <IActionResult> Create([Bind("MaCV,Ten")] ChucVu chucVu) { if (ModelState.IsValid) { _context.Add(chucVu); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(chucVu)); }
public async Task <IActionResult> Create([Bind("MaKH,Ten,DiaChi,DienThoai,NgayCapThe,Anh,NgayMuaGanNhat,DiemThuong")] KhachHang khachHang) { if (ModelState.IsValid) { _context.Add(khachHang); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(khachHang)); }
public async Task <IActionResult> Create([Bind("MaNV,Ten,NgaySinh,Phai,CMND,DiaChi,DienThoai,NgayVaoLam,MucGiam,MaCV,Username,Pwd,avatar,allowed")] NhanVien nhanVien) { if (ModelState.IsValid) { _context.Add(nhanVien); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(nhanVien)); }
public async Task <IActionResult> Create([Bind("MaHD,SoLuong,MaMH")] ChiTietHoaDon chiTietHoaDon) { if (ModelState.IsValid) { _context.Add(chiTietHoaDon); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(chiTietHoaDon)); }
public async Task <IActionResult> Create([Bind("MaDVT,Ten")] DonViTinh donViTinh) { if (ModelState.IsValid) { _context.Add(donViTinh); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(donViTinh)); }
public async Task <IActionResult> Create([Bind("MaNCC,Ten,DiaChi,DienThoai")] NhaCungCap nhaCungCap) { if (ModelState.IsValid) { _context.Add(nhaCungCap); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(nhaCungCap)); }
public async Task <IActionResult> Create([Bind("MaLH,Ten,MaCL")] LoaiHang loaiHang) { if (ModelState.IsValid) { _context.Add(loaiHang); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["MaCL"] = new SelectList(_context.ChungLoais, "MaCL", "MaCL", loaiHang.MaCL); return(View(loaiHang)); }
public async Task <IActionResult> Create([Bind("MaMH,Ten,MaLH,MaDVT,NgaySanXuat,SoLuongNhap,SoLuongBan,GiaBan,GiaMua,VAT,MoTa,NgayNhap,NgayHetHan,HinhMinhHoa")] MatHang matHang) { if (ModelState.IsValid) { _context.Add(matHang); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["MaDVT"] = new SelectList(_context.DonViTinhs, "MaDVT", "MaDVT", matHang.MaDVT); ViewData["MaLH"] = new SelectList(_context.LoaiHangs, "MaLH", "MaLH", matHang.MaLH); return(View(matHang)); }
public async Task <IActionResult> Create([Bind("MaHD,ThoiDiemLap,TongTienPhaiTra,MucGiam,MaNV,MaKH,DiemThuong")] HoaDon hoaDon) { if (ModelState.IsValid) { _context.Add(hoaDon); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["MaKH"] = new SelectList(_context.KhachHangs, "MaKH", "MaKH", hoaDon.MaKH); ViewData["MaNV"] = new SelectList(_context.NhanViens, "MaNV", "MaNV", hoaDon.MaNV); return(View(hoaDon)); }