public ActionResult Create(TamTruModel model)
 {
     if (ModelState.IsValid)
     {
         string user = User.Identity.Name.ToString();
         proxy.insertbyHotel(user, model.SelectedGiayToValue, model.SelectedLiDoValue, model.SelectedQuocTichValue,model.TT_FullName, model.TT_DiaChiThuongTru, model.TT_NgayDen, model.TT_NgayDi, model.TT_Room, model.TT_GiayTo, model.TT_LiDoKhac);
         return View("Success1");
     }
     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);
     return View(model);
 }
        public TamTruModel getTTTVByID(int id)
        {
            TTTV__TamTru item = proxy.getTamTruById(id);
            TamTruModel model = new TamTruModel();

            model.MaTamTru = item.ID_TamTru;
            model.SelectedLiDoValue = item.ID_LiDo;
            model.SelectedQuocTichValue = item.ID_QuocTich;
            model.SelectedGiayToValue = item.ID_GiayTo;
            model.GiayTo = item.TTTV__GiayTo.GiayTo;
            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_Room = item.TT_Room;
            model.TT_GiayTo = item.TT_GiayTo;
            model.TT_LiDoKhac = item.TT_LiDoKhac;
            model.username = item.TaiKhoanDangKi;
            return model;
        }
 public IList<TamTruModel> getAllTTTV(string username)
 {
     IList<TamTruModel> list = new List<TamTruModel>();
     var data = proxy.getAllTamTru().Where(e=>e.TaiKhoanDangKi==username);
     foreach (var item in data)
     {
         TamTruModel model = new TamTruModel();
         model.MaTamTru = item.ID_TamTru;
         model.GiayTo = item.TTTV__GiayTo.GiayTo;
         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_Room = item.TT_Room;
         model.TT_GiayTo = item.TT_GiayTo;
         model.username = item.TaiKhoanDangKi;
         list.Add(model);
     }
     return list;
 }
 public ActionResult Edit(TamTruModel model)
 {
     if (ModelState.IsValid)
     {
         string user = User.Identity.Name.ToString();
         proxy.UpdatetamtruByHotel(model.MaTamTru, model.SelectedGiayToValue, model.SelectedLiDoValue, model.SelectedQuocTichValue, model.TT_FullName, model.TT_DiaChiThuongTru, 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", model.SelectedGiayToValue);
     ViewData["LiDo"] = new SelectList(proxy.getAllLiDo(), "ID_LiDo", "LiDo", model.SelectedLiDoValue);
     ViewData["QuocTich"] = new SelectList(proxy.getAllQuocTich(), "ID_QuocTich", "QuocTich", model.SelectedQuocTichValue);
     return View();
 }