public ActionResult Edit([Bind(Include = "MaThuePhong,MaPhong,NgayBatDauThue")] ThuePhong thuePhong) { try { if (ModelState.IsValid) { db.Entry(thuePhong).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(View("SửaThànhCông")); } } catch { return(View("LỗiSửaTP")); } List <SelectListItem> tenPhong = new List <SelectListItem>(); foreach (var item in db.Phong) { if (item.TinhTrang == false) { tenPhong.Add(new SelectListItem { Text = item.TenPhong, Value = item.MaPhong.ToString() }); } } ViewBag.MaPhong = /*new SelectList(db.Phongs, "MaPhong", "MaPhong")*/ tenPhong; return(View(thuePhong)); }
public ActionResult Edit([Bind(Include = "MaPhong,TenPhong,MaLoai,GhiChu,TinhTrang")] Phong phong) { List <SelectListItem> loaiPhong = new List <SelectListItem>(); foreach (var item in db.LoaiPhong) { loaiPhong.Add(new SelectListItem { Text = item.TenLoai, Value = Convert.ToString(item.MaLoai) }); } ViewBag.LoaiPhong = loaiPhong; try { if (ModelState.IsValid) { db.Entry(phong).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(View("SửaPhòngTC")); } } catch { //return View("LỗiSửaPhòng"); } return(View(phong)); }
public ActionResult Edit([Bind(Include = "MaDoanhThu,Thang,TongDoanhThu")] DoanhThu doanhThu) { if (ModelState.IsValid) { db.Entry(doanhThu).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(doanhThu)); }
public ActionResult Edit([Bind(Include = "MaQuiDinh,TenQuiDinh,MoTa,ThamSo,ThamSoTien")] QuiDinh quiDinh) { if (ModelState.IsValid) { db.Entry(quiDinh).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(RedirectToAction("ThôngTinQuiĐịnh", new { id = Encryption.encrypt(quiDinh.MaQuiDinh.ToString()) })); } return(View(quiDinh)); }
public ActionResult Edit([Bind(Include = "MaHD,MaKhachHang,MaNV,TongTien")] HD hD) { List <SelectListItem> tenKH = new List <SelectListItem>(); foreach (var item in db.KhachHang) { tenKH.Add(new SelectListItem { Text = item.TenKhachHang, Value = Convert.ToString(item.MaKhachHang) }); } ViewBag.MaKH = /*new SelectList(db.KhachHangs, "MaKhachHang", "TenKhachHang")*/ tenKH; try { if (ModelState.IsValid) { db.Entry(hD).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(View("SửaThànhCôngHóaĐơn")); } } catch { return(View("LỗiKhiSửaHĐ")); } ViewBag.MaTP = new SelectList(db.ThuePhong, "MaThuePhong", "MaThuePhong", thuePhong.MaThuePhong); List <SelectListItem> tenNV = new List <SelectListItem>(); foreach (var item in db.NV) { if (item.ChucVu.TenCV == "Ke Toan" || item.ChucVu.TenCV == "Ke Toan Truong") { tenNV.Add(new SelectListItem { Text = item.TenNV, Value = Convert.ToString(item.MaNV) }); } } ViewBag.MaNV = tenNV; return(View(hD)); }
public ActionResult Edit([Bind(Include = "Email,Pass,MaNV,Roles,NV")] TaiKhoan userprofile) { if (ModelState.IsValid) { db.Entry(userprofile).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("ThôngTinTàiKhoản", new { id = Encryption.encrypt(userprofile.MaNV.ToString()) })); } return(View(userprofile)); }
public ActionResult Edit([Bind(Include = "Email,Pass,MaNV,Roles")] TaiKhoan taiKhoan) { if (ModelState.IsValid) { db.Entry(taiKhoan).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.MaNV = new SelectList(db.NV, "MaNV", "TenNV", taiKhoan.MaNV); return(View(taiKhoan)); }
public ActionResult Edit([Bind(Include = "MaKhachHang,TenKhachHang,MaLoaiKhach,DiaChi,CMND")] KhachHang khachHang) { if (ModelState.IsValid) { db.Entry(khachHang).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(RedirectToAction("ThôngTinKháchHàng", new { id = Encryption.encrypt(khachHang.MaKhachHang.ToString()) })); } ViewBag.MaLoaiKhach = new SelectList(db.LoaiKhach, "MaLoaiKhach", "TenLoaiKhach", khachHang.MaLoaiKhach); return(View(khachHang)); }
public ActionResult Edit([Bind(Include = "MaThuePhong,MaKhachHang,SoLuongKhach")] ChiTietThuePhong chiTietThuePhong) { if (ModelState.IsValid) { db.Entry(chiTietThuePhong).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(RedirectToAction("ChiTiết", new { id = chiTietThuePhong.MaThuePhong, khachHang = chiTietThuePhong.MaKhachHang })); } ViewBag.MaKhachHang = new SelectList(db.KhachHang, "MaKhachHang", "TenKhachHang", chiTietThuePhong.MaKhachHang); ViewBag.MaThuePhong = new SelectList(db.ThuePhong, "MaThuePhong", "MaThuePhong", chiTietThuePhong.MaThuePhong); return(View(chiTietThuePhong)); }
public ActionResult Edit([Bind(Include = "MaHD,MaThuePhong,NgayThanhToan,SoNgayThue,ThanhTien")] ChiTietHoaDon chiTietHoaDon) { if (ModelState.IsValid) { db.Entry(chiTietHoaDon).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.MaHD = new SelectList(db.HD, "MaHD", "MaHD", chiTietHoaDon.MaHD); ViewBag.MaThuePhong = new SelectList(db.ThuePhong, "MaThuePhong", "MaThuePhong", chiTietHoaDon.MaThuePhong); return(View(chiTietHoaDon)); }
public ActionResult Edit([Bind(Include = "MaLoai,TenLoai,Dongia")] LoaiPhong loaiPhong) { try { if (ModelState.IsValid) { db.Entry(loaiPhong).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(RedirectToAction("ThêmLoạiPhòngTC", new { id = Encryption.encrypt(loaiPhong.MaLoai.ToString()) })); } } catch { return(View("LỗiLoạiPhòng")); } return(View(loaiPhong)); }
public ActionResult Edit([Bind(Include = "MaDoanhThu,LoaiPhong,DoanhThu,Tile")] ChiTietDoanhThu chiTietDoanhThu) { try { if (ModelState.IsValid) { db.Entry(chiTietDoanhThu).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(View("SửaDoanhThuTC")); } } catch { return(View("LỗiSửaDoanhThu")); } return(View(chiTietDoanhThu)); }
public ActionResult Edit([Bind(Include = "MaCV,TenCV")] ChucVu chucVu) { try { if (ModelState.IsValid) { db.Entry(chucVu).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(View("SửaChứcVụThànhCông")); } } catch { return(View("LỗiChứcVụ")); } return(View(chucVu)); }
public ActionResult Edit([Bind(Include = "MaNV,TenNV,MaCV,SDTNV,DCNV")] NV nV) { List <SelectListItem> selectList1 = new List <SelectListItem>(); List <SelectListItem> selectList2 = new List <SelectListItem>(); List <SelectListItem> selectList3 = new List <SelectListItem>(); List <SelectListItem> selectList4 = new List <SelectListItem>(); foreach (var item in db.ChucVu) { if (item.MaCV == 1) { selectList1.Add(new SelectListItem { Text = item.TenCV, Value = item.MaCV.ToString() }); } else if (item.MaCV == 2 && item.MaCV != 1) { selectList2.Add(new SelectListItem { Text = item.TenCV, Value = item.MaCV.ToString() }); } else if (item.MaCV == 3 && item.MaCV != 1 && item.MaCV != 2) { selectList3.Add(new SelectListItem { Text = item.TenCV, Value = item.MaCV.ToString() }); } else if (item.MaCV != 1 || item.MaCV != 2 || item.MaCV != 3) { selectList4.Add(new SelectListItem { Text = item.TenCV, Value = item.MaCV.ToString() }); } } ViewBag.TenCV1 = /*new SelectList(db.ChucVus, "MaCV", "TenCV")*/ selectList1; ViewBag.TenCV2 = /*new SelectList(db.ChucVus, "MaCV", "TenCV")*/ selectList2; ViewBag.TenCV3 = /*new SelectList(db.ChucVus, "MaCV", "TenCV")*/ selectList3; ViewBag.TenCV4 = /*new SelectList(db.ChucVus, "MaCV", "TenCV")*/ selectList4; try { if (ModelState.IsValid) { db.Entry(nV).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(View("SửaNVTC")); } } catch { return(View("LỗiSửaNV")); } return(View(nV)); }