public ActionResult Searching() { CAboutRoomViewModel abtRoom_VM = new CAboutRoomViewModel(); //建案 CBuildCaseViewModel buildcase_VM = new CBuildCaseViewModel(); List <CBuildCaseViewModel> buildcase_VM_lt = new List <CBuildCaseViewModel>(); var b = dbSA.BuildCase; foreach (var item in b) { buildcase_VM_lt.Add(new CBuildCaseViewModel() { entity_buildcase = item }); } abtRoom_VM.buildcaseViewModels = buildcase_VM_lt; //Roomstyle CRoomStyleViewModel roomstyle_VM = new CRoomStyleViewModel(); List <CRoomStyleViewModel> roomstyle_VM_lt = new List <CRoomStyleViewModel>(); var rs = dbSA.RoomStyle; foreach (var item in rs) { roomstyle_VM_lt.Add(new CRoomStyleViewModel() { entity_roomstyle = item }); } abtRoom_VM.roomStyleViewModels = roomstyle_VM_lt; return(View(abtRoom_VM)); }
public ActionResult ListRoomDetail(string roomstyleID) { CAboutRoomViewModel abtRoom_VM = new CAboutRoomViewModel(); var result = dbSA.Room.Where(r => r.RoomStyleID.ToString() == roomstyleID); List <CRoomViewModel> rooom_VM_lt = new List <CRoomViewModel>(); var test = result.ToList(); foreach (var item in result) { CRoomViewModel room_VM = new CRoomViewModel() { entity_room = item }; rooom_VM_lt.Add(room_VM); } abtRoom_VM.roomViewModels = rooom_VM_lt; ViewData.Model = abtRoom_VM; ViewBag.roomstyleid = roomstyleID; return(View(abtRoom_VM)); }
public ActionResult PartialResult(string buildcaseID, string roomstyleID, string peoplecount, string amountrent) { CAboutRoomViewModel abtRoom_VM = new CAboutRoomViewModel(); var result = from t in dbSA.BuildCase join r in dbSA.Room on t.ID equals r.BuildCaseID join rms in dbSA.RoomStyle on r.RoomStyleID equals rms.ID where t.ID == buildcaseID && r.RoomStyleID.ToString() == roomstyleID && rms.MaxNumberOfPeople.ToString() == peoplecount //rms.Rent.ToString() == amountrent select new { b = t, r = r, rms = rms }; List <CRoomStyleViewModel> roomstyle_VM_lt = new List <CRoomStyleViewModel>(); List <CBuildCaseViewModel> buildcase_VM_lt = new List <CBuildCaseViewModel>(); List <CRoomViewModel> room_VM_lt = new List <CRoomViewModel>(); var test = result.ToList(); foreach (var item in result) { CRoomStyleViewModel roomstyle_VM = new CRoomStyleViewModel() { entity_roomstyle = item.rms }; roomstyle_VM_lt.Add(roomstyle_VM); CBuildCaseViewModel buildcase_VM = new CBuildCaseViewModel() { entity_buildcase = item.b }; buildcase_VM_lt.Add(buildcase_VM); CRoomViewModel room_VM = new CRoomViewModel() { entity_room = item.r }; room_VM_lt.Add(room_VM); } abtRoom_VM.buildcaseViewModels = buildcase_VM_lt; abtRoom_VM.roomStyleViewModels = roomstyle_VM_lt; abtRoom_VM.roomViewModels = room_VM_lt; ViewData.Model = abtRoom_VM; return(PartialView("_PartialSearchResult")); }
public ActionResult MyRoom() { CAboutRoomViewModel abtRoom_VM = new CAboutRoomViewModel(); var user = Session[CDictionary.welcome] as CMember; if (user == null) { return(RedirectToAction("Login", "Member")); } CMember member = Session[CDictionary.welcome] as CMember; int memberID = member.fMemberId; var result = from L in dbSA.Lease join R in dbSA.Room on L.RoomID equals R.ID where L.MemberID == memberID select new { L, R }; List <CRoomViewModel> List_Room = new List <CRoomViewModel>(); List <CLeaseViewModel> List_Lease = new List <CLeaseViewModel>(); var test = result.ToList(); foreach (var item in result) { CRoomViewModel ViewM_Room = new CRoomViewModel() { entity_room = item.R }; List_Room.Add(ViewM_Room); CLeaseViewModel ViewM_Lease = new CLeaseViewModel() { entity_lease = item.L }; List_Lease.Add(ViewM_Lease); } abtRoom_VM.roomViewModels = List_Room; abtRoom_VM.leaseViewModels = List_Lease; ViewData.Model = abtRoom_VM; return(View(abtRoom_VM)); }
public ActionResult ListAllRooms( string buildcaseID, string roomname, string roomstyleID, string area) { CAboutRoomViewModel abtRoom_VM = new CAboutRoomViewModel(); var result = from b in dbSA.BuildCase join r in dbSA.Room on b.ID equals r.BuildCaseID join rms in dbSA.RoomStyle on r.RoomStyleID equals rms.ID where b.ID == buildcaseID && rms.ID.ToString() == roomstyleID select new { b = b, r = r, rms = rms }; List <CBuildCaseViewModel> buildcase_VM_lt = new List <CBuildCaseViewModel>(); List <CRoomViewModel> rooom_VM_lt = new List <CRoomViewModel>(); List <CRoomStyleViewModel> roomstyle_VM_lt = new List <CRoomStyleViewModel>(); var test = result.ToList(); foreach (var item in result) { CBuildCaseViewModel buildcase_VM = new CBuildCaseViewModel() { entity_buildcase = item.b }; buildcase_VM_lt.Add(buildcase_VM); CRoomStyleViewModel roomstyle_VM = new CRoomStyleViewModel() { entity_roomstyle = item.rms }; roomstyle_VM_lt.Add(roomstyle_VM); CRoomViewModel room_VM = new CRoomViewModel() { entity_room = item.r }; rooom_VM_lt.Add(room_VM); } abtRoom_VM.buildcaseViewModels = buildcase_VM_lt; abtRoom_VM.roomStyleViewModels = roomstyle_VM_lt; abtRoom_VM.roomViewModels = rooom_VM_lt; ViewData.Model = abtRoom_VM; return(View(abtRoom_VM)); }
public ActionResult MemberInfo() { CAboutRoomViewModel abtRoom_VM = new CAboutRoomViewModel(); List <CMemberViewModel> mem_VM_lt = new List <CMemberViewModel>(); var a = dbSA.tMember.Where(m => m.fMemberId == 1); foreach (var item in a) { mem_VM_lt.Add(new CMemberViewModel() { entity_Member = item }); } abtRoom_VM.memberViewModels = mem_VM_lt; return(View(abtRoom_VM)); }
public ActionResult BookingDone(int id) { CAboutRoomViewModel abtRoom_VM = new CAboutRoomViewModel(); //For room List <CRoomViewModel> r_VM_lt = new List <CRoomViewModel>(); var a = dbSA.Room.Where(r => r.RoomStyleID == id); foreach (var item in a) { r_VM_lt.Add(new CRoomViewModel() { entity_room = item }); } abtRoom_VM.roomViewModels = r_VM_lt; // For roomstyle CRoomStyleViewModel roomsty_VM = new CRoomStyleViewModel(); List <CRoomStyleViewModel> rsty_VM_lt = new List <CRoomStyleViewModel>(); var b = dbSA.RoomStyle.Where(r => r.ID == id); foreach (var item in b) { rsty_VM_lt.Add(new CRoomStyleViewModel() { entity_roomstyle = item }); } abtRoom_VM.roomStyleViewModels = rsty_VM_lt; //for pic. CPictureViewModel roompic_VM = new CPictureViewModel(); List <CPictureViewModel> rpic_VM_lt = new List <CPictureViewModel>(); var c = dbSA.Picture.Where(r => r.ID == id); foreach (var item in c) { rpic_VM_lt.Add(new CPictureViewModel() { entity_picture = item }); } abtRoom_VM.roomPicViewModels = rpic_VM_lt; //for facility CFacilityViewModel facility_VM = new CFacilityViewModel(); List <CFacilityViewModel> facility_VM_lt = new List <CFacilityViewModel>(); var i = dbSA.RoomStyle.Where(r => r.ID == id).FirstOrDefault(); foreach (var item in i.RoomFacilities) { facility_VM_lt.Add(new CFacilityViewModel() { entity_Facility = item.Facility }); } abtRoom_VM.facilityViewModels = facility_VM_lt; return(View(abtRoom_VM)); }
public ActionResult Searching( string buildcaseID, string roomstyleID, string peoplecount, string amountrent) { CAboutRoomViewModel abtRoom_VM = new CAboutRoomViewModel(); #region Find room by buildcase CBuildCaseViewModel buildcase_VM = new CBuildCaseViewModel(); List <CBuildCaseViewModel> buildcase_VM_lt = new List <CBuildCaseViewModel>(); var b = dbSA.BuildCase.Where(r => r.ID == buildcaseID); foreach (var item in b) { buildcase_VM_lt.Add(new CBuildCaseViewModel() { entity_buildcase = item }); } abtRoom_VM.buildcaseViewModels = buildcase_VM_lt; #endregion #region Find room by roomstyle CRoomStyleViewModel roomstyle_VM = new CRoomStyleViewModel(); List <CRoomStyleViewModel> roomstyle_VM_lt = new List <CRoomStyleViewModel>(); var rs = dbSA.RoomStyle.Where(i => i.ID.ToString() == roomstyleID); foreach (var item in rs) { roomstyle_VM_lt.Add(new CRoomStyleViewModel() { entity_roomstyle = item }); } abtRoom_VM.roomStyleViewModels = roomstyle_VM_lt; #endregion #region Find room by peoplecount var p = dbSA.RoomStyle.Where(t => t.MaxNumberOfPeople.ToString() == peoplecount); foreach (var item in p) { roomstyle_VM_lt.Add(new CRoomStyleViewModel() { entity_roomstyle = item }); } abtRoom_VM.roomStyleViewModels = roomstyle_VM_lt; #endregion #region Find room by rent var a = dbSA.RoomStyle.Where(f => f.Rent.ToString() == amountrent); foreach (var item in a) { roomstyle_VM_lt.Add(new CRoomStyleViewModel() { entity_roomstyle = item }); } abtRoom_VM.roomStyleViewModels = roomstyle_VM_lt; #endregion ViewData.Model = abtRoom_VM; ViewBag.amountrent = amountrent; ViewBag.peoplecount = peoplecount; ViewBag.buildcaseID = buildcaseID; ViewBag.roomstyleID = roomstyleID; return(RedirectToAction("ListAllRooms", new { buildcaseID = buildcaseID, roomstyleID = roomstyleID, peoplecount = peoplecount, amountrent = amountrent })); }
//GET public ActionResult ListRoomDetail(int id) { CAboutRoomViewModel abtRoom_VM = new CAboutRoomViewModel(); var result = from r in dbSA.Room join b in dbSA.BuildCase on r.BuildCaseID equals b.ID join rs in dbSA.RoomStyle on r.RoomStyleID equals rs.ID join rf in dbSA.RoomFacilities on rs.ID equals rf.RoomStyleID join f in dbSA.Facility on rf.FacilityID equals f.ID where r.ID == id select new { r = r, b = b, rs = rs, rf = rf, f = f }; List <CBuildCaseViewModel> buildcase_VM_lt = new List <CBuildCaseViewModel>(); List <CRoomViewModel> rooom_VM_lt = new List <CRoomViewModel>(); List <CRoomStyleViewModel> roomstyle_VM_lt = new List <CRoomStyleViewModel>(); List <CRoomFacilityViewModel> roomfacility_VM_lt = new List <CRoomFacilityViewModel>(); List <CFacilityViewModel> facility_VM_lt = new List <CFacilityViewModel>(); var test = result.ToList(); //有4個 foreach (var item in result) { CBuildCaseViewModel buildcase_VM = new CBuildCaseViewModel() { entity_buildcase = item.b }; buildcase_VM_lt.Add(buildcase_VM); CRoomStyleViewModel roomstyle_VM = new CRoomStyleViewModel() { entity_roomstyle = item.rs }; roomstyle_VM_lt.Add(roomstyle_VM); CRoomViewModel room_VM = new CRoomViewModel() { entity_room = item.r }; rooom_VM_lt.Add(room_VM); CRoomFacilityViewModel roomfacility_VM = new CRoomFacilityViewModel() { entity_roomfacilities = item.rf }; roomfacility_VM_lt.Add(roomfacility_VM); CFacilityViewModel facility_VM = new CFacilityViewModel() { entity_Facility = item.f }; facility_VM_lt.Add(facility_VM); } abtRoom_VM.buildcaseViewModels = buildcase_VM_lt; abtRoom_VM.roomfacilityViewModel = roomfacility_VM_lt; abtRoom_VM.roomStyleViewModels = roomstyle_VM_lt; abtRoom_VM.roomViewModels = rooom_VM_lt; abtRoom_VM.facilityViewModels = facility_VM_lt; ViewData.Model = abtRoom_VM; return(View(abtRoom_VM)); }
//PartialRoomFavorite //public ActionResult PartialRoomFavorite(string MemberID, int page = 1, int pageSize = 6) //{ // SingleApartmentEntities db = new SingleApartmentEntities(); // var list = db.RoomFavorite.Where(r => r.MemberID.ToString() == MemberID); // int currentPage = page < 1 ? 1 : page; // List<CRoomFavorite> lt = new List<CRoomFavorite>(); // foreach (var item in list) // { // lt.Add(new CRoomFavorite { entity_RoomFavorite = item }); // } // var result = lt.ToPagedList(currentPage, pageSize); // ViewData.Model = result; // ViewBag.MemberID = MemberID; // return PartialView("_PartialRoomFavorite"); //} //GET public ActionResult ListRoomDetail(int id) { CAboutRoomViewModel abtRoom_VM = new CAboutRoomViewModel(); var result = from r in dbSA.Room join rs in dbSA.RoomStyle on r.RoomStyleID equals rs.ID join b in dbSA.BuildCase on r.BuildCaseID equals b.ID where r.ID == id select new { r = r, b = b, rs = rs, }; List <CBuildCaseViewModel> buildcase_VM_lt = new List <CBuildCaseViewModel>(); List <CRoomViewModel> rooom_VM_lt = new List <CRoomViewModel>(); List <CRoomStyleViewModel> roomstyle_VM_lt = new List <CRoomStyleViewModel>(); List <CRoomFacilityViewModel> roomfacility_VM_lt = new List <CRoomFacilityViewModel>(); List <CFacilityViewModel> facility_VM_lt = new List <CFacilityViewModel>(); var test = result.ToList(); //有4個 foreach (var item in result) { CBuildCaseViewModel buildcase_VM = new CBuildCaseViewModel() { entity_buildcase = item.b }; buildcase_VM_lt.Add(buildcase_VM); CRoomStyleViewModel roomstyle_VM = new CRoomStyleViewModel() { entity_roomstyle = item.rs }; roomstyle_VM_lt.Add(roomstyle_VM); CRoomViewModel room_VM = new CRoomViewModel() { entity_room = item.r }; rooom_VM_lt.Add(room_VM); } List <CLeaseViewModel> lease_VM_lt = new List <CLeaseViewModel>(); var l_result = from l in dbSA.Lease select l; foreach (var litem in l_result) { CLeaseViewModel lease_VM = new CLeaseViewModel() { entity_lease = litem }; lease_VM_lt.Add(lease_VM); } CMember member = Session[CDictionary.welcome] as CMember; abtRoom_VM.buildcaseViewModels = buildcase_VM_lt; abtRoom_VM.roomfacilityViewModel = roomfacility_VM_lt; abtRoom_VM.roomStyleViewModels = roomstyle_VM_lt; abtRoom_VM.roomViewModels = rooom_VM_lt; abtRoom_VM.facilityViewModels = facility_VM_lt; abtRoom_VM.leaseViewModels = lease_VM_lt; ViewData.Model = abtRoom_VM; return(View(abtRoom_VM)); }