public IList<TamTruModel> getHistory(string username) { IList<TamTruModel> list = new List<TamTruModel>(); var data = proxy.getHistory(username); foreach (var item in data) { TamTruModel model = new TamTruModel(); model.MaTamTru = item.ID_TamTru; model.loai = item.ID_Type; model.Tinh = proxy.Tinh(item.ProvinceID); model.Quan = proxy.Quan(item.ProvinceID, item.DistrictID); model.Phuong = proxy.Phuong(item.ProvinceID, item.DistrictID, item.DetailProvinceID); model.SelectedDetailProvincesValue = item.DetailProvinceID; model.SelectedDistrictValue = item.DistrictID; model.SelectedProvinceValue = item.ProvinceID; model.SelectedStatusValue = item.ID_Status; model.Type = item.TTTV__Type.Type; model.GiayTo = item.TTTV__GiayTo.GiayTo; model.TrangThai = item.TTTV__Status.Status; model.QuocTich = item.TTTV__QuocTich.QuocTich; model.LiDo = item.TTTV__LiDo.LiDo; model.TT_FullName = item.TT_FullName; model.TT_NgayDen = item.TT_NgayDen; model.TT_NgayDi = item.TT_NgayDi; model.TT_DiaChiThuongTru = item.TT_DiaChiThuongTru; model.TT_DiaChiTamTru = item.TT_DiaChiTamTru; model.TT_Room = item.TT_Room; model.TT_GiayTo = item.TT_GiayTo; model.username = item.TaiKhoanDangKi; list.Add(model); } return list; }
public ActionResult Create(TamTruModel model) { if (ModelState.IsValid) { string user = User.Identity.Name.ToString(); proxy.insertAtPolice(model.SelectedGiayToValue, model.SelectedLiDoValue, model.SelectedQuocTichValue, model.SelectedProvinceValue, model.SelectedDistrictValue, model.SelectedDetailProvincesValue, model.TT_FullName, model.TT_DiaChiThuongTru, model.TT_DiaChiTamTru, model.TT_NgayDen, model.TT_NgayDi, model.TT_Room, model.TT_GiayTo, model.TT_LiDoKhac, user); return RedirectToAction("Index"); } ViewData["GiayTo"] = new SelectList(proxy.getAllGiayTo(), "ID_GiayTo", "GiayTo"); ViewData["LiDo"] = new SelectList(proxy.getAllLiDo(), "ID_LiDo", "LiDo"); ViewData["QuocTich"] = new SelectList(proxy.getAllQuocTich(), "ID_QuocTich", "QuocTich"); ViewData["Tinh"] = new SelectList(proxy.getAllProvince(), "ProvinceID", "ProvinceName"); ViewData["Quan"] = new SelectList(proxy.getAllDistrict(), "DistrictID", "DistrictName"); ViewData["Phuong"] = new SelectList(proxy.getAllDetailProvince(), "DetailID", "DetailName"); return View(model); }
public TamTruModel getTTTVByID(int id) { TTTV__TamTru item = proxy.getTamTruById(id); TamTruModel model = new TamTruModel(); model.MaTamTru = item.ID_TamTru; model.loai = item.ID_Type; model.Tinh = proxy.Tinh(item.ProvinceID); model.Quan = proxy.Quan(item.ProvinceID, item.DistrictID); model.Phuong = proxy.Phuong(item.ProvinceID, item.DistrictID, item.DetailProvinceID); model.SelectedDetailProvincesValue = item.DetailProvinceID; model.SelectedDistrictValue = item.DistrictID; model.SelectedProvinceValue = item.ProvinceID; model.SelectedTypeValue = item.ID_Type; model.SelectedLiDoValue = item.ID_LiDo; model.SelectedQuocTichValue = item.ID_QuocTich; model.SelectedGiayToValue = item.ID_GiayTo; model.SelectedStatusValue = item.ID_Status; model.Type = item.TTTV__Type.Type; model.GiayTo = item.TTTV__GiayTo.GiayTo; model.TrangThai = item.TTTV__Status.Status; model.QuocTich = item.TTTV__QuocTich.QuocTich; model.LiDo = item.TTTV__LiDo.LiDo; model.TT_FullName = item.TT_FullName; model.TT_NgayDen = item.TT_NgayDen; model.TT_NgayDi = item.TT_NgayDi; model.TT_DiaChiThuongTru = item.TT_DiaChiThuongTru; model.TT_DiaChiTamTru = item.TT_DiaChiTamTru; model.TT_Room = item.TT_Room; model.TT_GiayTo = item.TT_GiayTo; model.TT_LiDoKhac = item.TT_LiDoKhac; model.username = item.TaiKhoanDangKi; return model; }
public ActionResult Edit(TamTruModel model) { if (ModelState.IsValid) { string user = User.Identity.Name.ToString(); try { proxy.Updatetamtru(model.MaTamTru, model.SelectedTypeValue, model.SelectedGiayToValue, model.SelectedLiDoValue, model.SelectedQuocTichValue, model.SelectedStatusValue, model.TT_FullName, model.TT_DiaChiThuongTru, model.TT_DiaChiTamTru, model.TT_NgayDen, model.TT_NgayDi, model.TT_Room, model.TT_GiayTo, model.TT_LiDoKhac, user); } catch(FaultException<FaultOutOfMemory> cex) { FaultModel fault = new FaultModel(); fault.Issue = cex.Message; fault.Detail = cex.Reason.ToString() ; return View("fault", fault); } return RedirectToAction("Details", new { id = model.MaTamTru }); } ViewData["GiayTo"] = new SelectList(proxy.getAllGiayTo(), "ID_GiayTo", "GiayTo", model.SelectedGiayToValue); ViewData["LiDo"] = new SelectList(proxy.getAllLiDo(), "ID_LiDo", "LiDo", model.SelectedLiDoValue); ViewData["QuocTich"] = new SelectList(proxy.getAllQuocTich(), "ID_QuocTich", "QuocTich", model.SelectedQuocTichValue); ViewData["Status"] = new SelectList(proxy.getAllStatus(), "ID_Status", "Status", model.SelectedStatusValue); ViewData["Type"] = new SelectList(proxy.getAllType(), "ID_Type", "Type", model.SelectedTypeValue); return View(); }