public ActionResult ThemNguoi(CHITIETPHONGLOAD ctp) { if (ModelState.IsValid) { if (cc.Create(ctp)) { return(RedirectToAction("DetailPhong", new { id = ctp.IDCT })); } else { ModelState.AddModelError("", "Quá số người quy định"); } } return(View(ctp)); }
public ActionResult Create(LOAIPHONG loaiphong) { if (ModelState.IsValid) { if (loaiphong.ANH == null) { loaiphong.ANH = ""; } if (loaiphong.MOTA == null) { loaiphong.MOTA = ""; } if (loaiphong.SOGIUONG == null) { loaiphong.SOGIUONG = 1; } if (cc.Create(loaiphong)) { return(RedirectToAction("Index", "LoaiPhong")); } else { ModelState.AddModelError("", "Lỗi do trường dữ liệu nhập không hợp lệ"); } } return(View()); }
public ActionResult Dangky(FormCollection collection, KHACHHANG kh) { var hoten = collection["HotenKH"]; var tendn = collection["TenDN"]; var matkhau = collection["MatKhau"]; var matkhaunhaplai = collection["Matkhaunhaplai"]; var diachi = collection["Diachi"]; var email = collection["Email"]; var dienthoai = collection["DienThoai"]; var ngaysinh = String.Format("{0:MM/dd/yyyy}", collection["Ngaysinh"]); if (String.IsNullOrEmpty(hoten)) { ViewData["Loi1"] = "Họ tên khách hàng không được đễ trống"; } else if (String.IsNullOrEmpty(tendn)) { ViewData["Loi2"] = "Tên Đăng Nhập không được đễ trống"; } else if (String.IsNullOrEmpty(matkhau)) { ViewData["Loi3"] = "Mật Khẩu không được đễ trống"; } else if (String.IsNullOrEmpty(matkhaunhaplai)) { ViewData["Loi4"] = "Phải nhập lại mật khẩu"; } if (String.IsNullOrEmpty(dienthoai)) { ViewData["Loi5"] = "Phải nhập điện thoại"; } if (String.IsNullOrEmpty(ngaysinh)) { ViewData["Loi6"] = "Phải nhập ngày sinh"; } if (String.IsNullOrEmpty(diachi)) { ViewData["Loi7"] = "Phải nhập địa chỉ"; } if (String.IsNullOrEmpty(email)) { ViewData["Loi8"] = "Phải nhập email"; } else { kh.HoTenKH = hoten; kh.TenDN = tendn; kh.Matkhau = matkhau; kh.Email = email; kh.DiachiKH = diachi; kh.DienthoaiKH = dienthoai; kh.Ngaysinh = DateTime.Parse(ngaysinh); if (cc4.Create(kh)) { return(RedirectToAction("Dangnhap")); } } return(this.Dangky()); }
public ActionResult Create(DICHVU dichvu) { if (ModelState.IsValid) { if (cc.Create(dichvu)) { return(RedirectToAction("Index", "DichVu")); } else { ModelState.AddModelError("", "Đã có sản phẩm tên :" + dichvu.TEN); } } return(View()); }
public ActionResult Create(NHANVIEN nhanvien) { if (ModelState.IsValid) { /// Mã hóa mật khẩu .... if (cc.Create(nhanvien)) { return(RedirectToAction("Index", "NhanVien")); } else { ModelState.AddModelError("", "Đã có Username " + nhanvien.USERNAME); } } return(View()); }
public ActionResult Create(FormCollection collection, CHITIETPHONG ct) { if (ModelState.IsValid) { int num; int.TryParse(collection["var2"], out num); ct.IDCT = num; if (cc.Create(ct)) { return(RedirectToAction("Index")); } else { ModelState.AddModelError("", "Lỗi khi thêm"); } } ViewBag.var2 = new SelectList(cc.LoadThuePhong(0), "ID", "PHONG"); return(View()); }
public ActionResult Create(FormCollection collection, SDDV sddv) { if (ModelState.IsValid) { int num, num2; int.TryParse(collection["var1"], out num); sddv.IDCT = num; int.TryParse(collection["var2"], out num2); sddv.IDDV = num2; if (cc.Create(sddv)) { return(RedirectToAction("Index")); } else { ModelState.AddModelError("", "Lỗi khi thêm"); } } ViewBag.var1 = new SelectList(cc.LoadThuePhong(), "ID", "PHONG"); ViewBag.var2 = new SelectList(cc.LoadDichVu(), "ID", "TEN"); return(View()); }