public ActionResult ShowPlaceDetail(int id) { ResponseModel <PlaceDetailViewModel> response = null; var service = this.Service <IPlaceService>(); try { Place place = service.GetPlaceById(id); if (place != null) { PlaceDetailViewModel result = Mapper.Map <PlaceDetailViewModel>(place); result.StatusString = Utils.GetEnumDescription((PlaceStatus)result.Status); response = new ResponseModel <PlaceDetailViewModel>(true, "Thông tin địa điểm đã tải thành công", null, result); } else { response = ResponseModel <PlaceDetailViewModel> .CreateErrorResponse("Thất bại khi tải thông tin địa điểm!", systemError); } } catch (Exception) { response = ResponseModel <PlaceDetailViewModel> .CreateErrorResponse("Thất bại khi tải thông tin địa điểm!", systemError); } return(Json(response)); }
protected override async void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); _cover = e.Parameter as Cover; _viewModel = new PlaceDetailViewModel(_cover); await DispatcherHelper.ExecuteOnUIThreadAsync(async() => { _viewModel.LoadImages(); using (var db = new Context()) { var folders = db.Folders.Select(folder => new Folder(folder)).ToList(); await _cover.SetOriginalImageAsync(folders); } }); }
public ActionResult EditPlace(EditPlaceViewModel epvm1) { if (ModelState.IsValid) { if ((string)Session["userCode"] == "admin") { try { if (epvm1.PlaceId != 0) { Place place = (from c in entity.Places where c.PlaceId == epvm1.PlaceId select c).FirstOrDefault(); if (epvm1.PlaceTypeId == null) { epvm1.PlaceTypeId = Convert.ToInt32(place.PlaceTypeId); } if (epvm1.PlaceDetail == null) { epvm1.PlaceDetail = place.PlaceDetail; } Place p = (from c in entity.Places where c.PlaceId == epvm1.PlaceId select c).SingleOrDefault(); p.PlaceDetail = epvm1.PlaceDetail; p.PlaceTypeId = epvm1.PlaceTypeId; p.PlaceAddress = epvm1.PlaceAddress; p.PlaceName = epvm1.PlaceName; if (entity.SaveChanges() > 0) { ModelState.Clear(); TempData["EditPlace"] = "done"; return(RedirectToAction("SearchPlaceDetail", "Place", new { PlaceId = epvm1.PlaceId })); } else { TempData["EditPlace"] = "Problem occured"; return(RedirectToAction("SearchPlaceDetail", "Place", new { PlaceId = epvm1.PlaceId })); } } else { TempData["EditPlace"] = "Not chosen any data"; return(RedirectToAction("SearchPlaceDetail", "Place", new { PlaceId = epvm1.PlaceId })); } } catch (Exception ex) { return(View("Error", new HandleErrorInfo(ex, "Admin", "EditPlace"))); } } else { Session["message"] = "please log in First"; return(RedirectToAction("Welcome", "Home")); } } else { PlaceDetailViewModel sp = new PlaceDetailViewModel(); var p = (from c in entity.Places join e in entity.PlacePictures on c.PlaceProfilePicId equals e.PlacePictureId into ppl from e in ppl.DefaultIfEmpty() join f in entity.Countries on c.CountryId equals f.CountryId join g in entity.Cities on c.CityId equals g.CityId join k in entity.PlaceTypes on c.PlaceTypeId equals k.PlaceTypeId where c.PlaceId == epvm1.PlaceId orderby c.PlaceFavourite descending select new { c.PlaceId, c.PlaceName, e.PlacePictureData, k.PlaceTypeId, c.PlaceAddress, c.PlaceFavourite, f.CountryName, g.CityName, c.PlaceDetail, g.CityId, f.CountryId, k.PlaceTypeName, c.PlaceAdminsPermit, }).First(); if (p != null) { sp.PlacePictureData = p.PlacePictureData; sp.PlaceId = p.PlaceId; sp.PlaceName = p.PlaceName; sp.PlaceAddress = p.PlaceAddress; sp.PlaceLike = Convert.ToInt32(p.PlaceFavourite); sp.PlaceTypeName = p.PlaceTypeName; sp.CityName = p.CityName; sp.CountryName = p.CountryName; string st = CutDetail.StripHTML(p.PlaceDetail); sp.PlaceShortDetail = CutDetail.Truncate(st, 40); sp.PlaceFullDetail = p.PlaceDetail; sp.PlaceCityId = p.CityId; sp.PlaceCountryId = p.CountryId; sp.PlaceTypeId = p.PlaceTypeId; sp.PlaceAdminPermit = Convert.ToBoolean(p.PlaceAdminsPermit); } var q = sp; ViewData["pl"] = q; EditPlaceViewModel epvm = new EditPlaceViewModel(); epvm.CountryId = q.CountryId; epvm.CityId = q.CityId; epvm.PlaceName = q.PlaceName; epvm.PlaceAddress = q.PlaceAddress; epvm.PlaceTypeList = new SelectList(entity.PlaceTypes, "PlaceTypeId", "PlaceTypeName"); return(View(epvm)); } }
public ActionResult EditPlace(int PlaceId) { if ((string)Session["userCode"] == "admin") { try { PlaceDetailViewModel sp = new PlaceDetailViewModel(); var p = (from c in entity.Places join e in entity.PlacePictures on c.PlaceProfilePicId equals e.PlacePictureId into ppl from e in ppl.DefaultIfEmpty() join f in entity.Countries on c.CountryId equals f.CountryId join g in entity.Cities on c.CityId equals g.CityId join k in entity.PlaceTypes on c.PlaceTypeId equals k.PlaceTypeId where c.PlaceId == PlaceId orderby c.PlaceFavourite descending select new { c.PlaceId, c.PlaceName, e.PlacePictureData, k.PlaceTypeId, c.PlaceAddress, c.PlaceFavourite, f.CountryName, g.CityName, c.PlaceDetail, g.CityId, f.CountryId, k.PlaceTypeName, c.PlaceAdminsPermit, }).First(); if (p != null) { sp.PlacePictureData = p.PlacePictureData; sp.PlaceId = p.PlaceId; sp.PlaceName = p.PlaceName; sp.PlaceAddress = p.PlaceAddress; sp.PlaceLike = Convert.ToInt32(p.PlaceFavourite); sp.PlaceTypeName = p.PlaceTypeName; sp.CityName = p.CityName; sp.CountryName = p.CountryName; string st = CutDetail.StripHTML(p.PlaceDetail); sp.PlaceShortDetail = CutDetail.Truncate(st, 40); sp.PlaceFullDetail = p.PlaceDetail; sp.PlaceCityId = p.CityId; sp.PlaceCountryId = p.CountryId; sp.PlaceTypeId = p.PlaceTypeId; sp.PlaceAdminPermit = Convert.ToBoolean(p.PlaceAdminsPermit); } var q = sp; ViewData["pl"] = q; EditPlaceViewModel epvm = new EditPlaceViewModel(); epvm.CountryId = q.CountryId; epvm.CityId = q.CityId; epvm.PlaceName = q.PlaceName; epvm.PlaceAddress = q.PlaceAddress; epvm.PlaceTypeList = new SelectList(entity.PlaceTypes, "PlaceTypeId", "PlaceTypeName"); return(View(epvm)); } catch (Exception ex) { return(View("Error", new HandleErrorInfo(ex, "Place", "EditPlace"))); } } else { Session["message"] = "please log In first."; return(RedirectToAction("Welcome", "Home")); } }
public ActionResult NewPlaceListAdmin() { List <PlaceDetailViewModel> sp = new List <PlaceDetailViewModel>(); DateTime t = DateTime.Now.AddDays(-2); var p = (from c in entity.Places join e in entity.PlacePictures on c.PlaceProfilePicId equals e.PlacePictureId into ppl from e in ppl.DefaultIfEmpty() join f in entity.Countries on c.CountryId equals f.CountryId join g in entity.Cities on c.CityId equals g.CityId join k in entity.PlaceTypes on c.PlaceTypeId equals k.PlaceTypeId where c.PlaceDateOfAccountCreation >= t orderby c.PlaceFavourite descending select new { c.PlaceId, c.PlaceName, e.PlacePictureData, k.PlaceTypeId, c.PlaceAddress, c.PlaceFavourite, f.CountryName, g.CityName, g.CityId, f.CountryId, c.PlaceDetail, k.PlaceTypeName, c.PlaceAdminsPermit, }).ToList(); int x = p.Count(); if (x > 0) { foreach (var i in p) { PlaceDetailViewModel oivm = new PlaceDetailViewModel(); oivm.PlacePictureData = i.PlacePictureData; oivm.PlaceId = i.PlaceId; oivm.PlaceName = i.PlaceName; oivm.PlaceAddress = i.PlaceAddress; oivm.PlaceLike = Convert.ToInt32(i.PlaceFavourite); oivm.PlaceTypeName = i.PlaceTypeName; oivm.CityName = i.CityName; oivm.CountryName = i.CountryName; string st = CutDetail.StripHTML(i.PlaceDetail); oivm.PlaceShortDetail = CutDetail.Truncate(st, 40); oivm.PlaceFullDetail = i.PlaceDetail; oivm.PlaceCityId = i.CityId; oivm.PlaceCountryId = i.CountryId; oivm.PlaceTypeId = i.PlaceTypeId; oivm.PlaceAdminPermit = Convert.ToBoolean(i.PlaceAdminsPermit); sp.Add(oivm); } var q = sp; return(View(q)); } else { TempData["Place"] = "No data found"; return(RedirectToAction("UserPanel", "Home")); } }
public ActionResult SearchPlaceDetail(int PlaceId) { if (TempData["CheckInPlaceSearch"] != null) { TempData["CheckInPlaceSearch"] = TempData["CheckInPlaceSearch"]; } if (TempData["AddToWishPlaceSearch"] != null) { TempData["AddToWishPlaceSearch"] = TempData["AddToWishPlaceSearch"]; } if (TempData["PlaceBlock"] != null) { TempData["PlaceBlock"] = TempData["PlaceBlock"]; } if (TempData["PlaceProPic"] != null) { TempData["PlaceProPic"] = TempData["PlaceProPic"]; } if (TempData["EditPlace"] != null) { TempData["EditPlace"] = TempData["EditPlace"]; } PlaceDetailViewModel sp = new PlaceDetailViewModel(); if (PlaceId != 0) { var p = (from c in entity.Places join e in entity.PlacePictures on c.PlaceProfilePicId equals e.PlacePictureId into ppl from e in ppl.DefaultIfEmpty() join f in entity.Countries on c.CountryId equals f.CountryId join g in entity.Cities on c.CityId equals g.CityId join k in entity.PlaceTypes on c.PlaceTypeId equals k.PlaceTypeId where c.PlaceId == PlaceId orderby c.PlaceFavourite descending select new { c.PlaceId, c.PlaceName, e.PlacePictureData, k.PlaceTypeId, c.PlaceAddress, c.PlaceFavourite, f.CountryName, g.CityName, c.PlaceDetail, g.CityId, f.CountryId, k.PlaceTypeName, c.PlaceAdminsPermit, }).First(); if (p != null) { sp.PlacePictureData = p.PlacePictureData; sp.PlaceId = p.PlaceId; sp.PlaceName = p.PlaceName; sp.PlaceAddress = p.PlaceAddress; sp.PlaceLike = Convert.ToInt32(p.PlaceFavourite); sp.PlaceTypeName = p.PlaceTypeName; sp.CityName = p.CityName; sp.CountryName = p.CountryName; string st = CutDetail.StripHTML(p.PlaceDetail); sp.PlaceShortDetail = CutDetail.Truncate(st, 40); sp.PlaceFullDetail = p.PlaceDetail; sp.PlaceCityId = p.CityId; sp.PlaceCountryId = p.CountryId; sp.PlaceTypeId = p.PlaceTypeId; sp.PlaceAdminPermit = Convert.ToBoolean(p.PlaceAdminsPermit); } var q = sp; return(View(q)); } else { return(RedirectToAction("UserPanel", "Home")); } }
public ActionResult SearchPlaceListWithType(int CountryId, int CityId, int PlaceTypeId) { Session["SearchPlaceTypeId"] = PlaceTypeId; List <PlaceDetailViewModel> sp = new List <PlaceDetailViewModel>(); Session["SearchPlaceListType"] = "yes"; if (CountryId != 0 && CityId != 0) { var p = (from c in entity.Places join e in entity.PlacePictures on c.PlaceProfilePicId equals e.PlacePictureId into ppl from e in ppl.DefaultIfEmpty() join f in entity.Countries on c.CountryId equals f.CountryId join g in entity.Cities on c.CityId equals g.CityId join k in entity.PlaceTypes on c.PlaceTypeId equals k.PlaceTypeId where c.CountryId == CountryId && c.CityId == CityId && c.PlaceTypeId == PlaceTypeId && c.PlaceAdminsPermit == true orderby c.PlaceFavourite descending select new { c.PlaceId, c.PlaceName, e.PlacePictureData, k.PlaceTypeId, c.PlaceAddress, c.PlaceFavourite, f.CountryName, g.CityName, g.CityId, f.CountryId, c.PlaceDetail, k.PlaceTypeName, c.PlaceAdminsPermit, }).ToList(); int x = p.Count(); if (x > 0) { foreach (var i in p) { PlaceDetailViewModel oivm = new PlaceDetailViewModel(); oivm.PlacePictureData = i.PlacePictureData; oivm.PlaceId = i.PlaceId; oivm.PlaceName = i.PlaceName; oivm.PlaceAddress = i.PlaceAddress; oivm.PlaceLike = Convert.ToInt32(i.PlaceFavourite); oivm.PlaceTypeName = i.PlaceTypeName; oivm.CityName = i.CityName; oivm.CountryName = i.CountryName; string st = CutDetail.StripHTML(i.PlaceDetail); oivm.PlaceShortDetail = CutDetail.Truncate(st, 40); oivm.PlaceFullDetail = i.PlaceDetail; oivm.PlaceCityId = i.CityId; oivm.PlaceCountryId = i.CountryId; oivm.PlaceTypeId = i.PlaceTypeId; oivm.PlaceAdminPermit = Convert.ToBoolean(i.PlaceAdminsPermit); sp.Add(oivm); } var q = sp; TempData["CountryId"] = CountryId; TempData["CityId"] = CityId; return(View(q)); } else { return(RedirectToAction("Search", "Home", new { CountryId = CountryId, CityId = CityId, Arrival = "", Departure = "" })); } } else { return(RedirectToAction("Search", "Home", new { CountryId = CountryId, CityId = CityId, Arrival = "", Departure = "" })); } }
public PlaceDetailPage() { InitializeComponent(); BindingContext = viewModel = new PlaceDetailViewModel(); }
public PlaceDetailPage() { InitializeComponent(); BindingContext = _viewModel = App.Current.Services.GetService <PlaceDetailViewModel>(); }
public PlaceDetail(PlaceItemSummary lieu) { InitializeComponent(); BindingContext = new PlaceDetailViewModel(lieu); }
protected override bool OnBackButtonPressed() { PlaceDetailViewModel viewModel = BindingContext as PlaceDetailViewModel; return(viewModel.OnBackButtonPressed()); }