Esempio n. 1
0
        public ActionResult New(int categoryId)
        {
            ViewBag.CategoryName = db.bp_Category_GetById(categoryId).Single().Name;

            bp_Place place = new bp_Place();

            place.PlaceId = Guid.NewGuid();
            return(View(place));
        }
Esempio n. 2
0
        public ActionResult Edit(Guid placeId)
        {
            if (db.bp_Place_GetById(placeId).Single().UserId == (Guid)Membership.GetUser().ProviderUserKey)
            {
                bp_Place place = db.bp_Place_GetById(placeId).Single();
                ViewBag.Category = db.bp_Category_GetById(place.CategoryId).Single();
                place.Descript   = HttpUtility.HtmlDecode(place.Descript);

                return(View(place));
            }
            else
            {
                return(RedirectToAction("Details", "Place", new { placeId = placeId }));
            }
        }
Esempio n. 3
0
        public ActionResult Edit(bp_Place place)
        {
            if (ModelState.IsValid)
            {
                db.bp_Place_Update(
                    place.PlaceId,
                    place.CategoryId,
                    place.Title,
                    place.Latitude,
                    place.Longitude,
                    place.Descript,
                    place.PhoneNumber,
                    place.Address,
                    place.WebSite);

                db.bp_Place_UpdateState(place.PlaceId, (int)PlaceState.Waitting);

                return(RedirectToAction("Details", new { placeId = place.PlaceId }));
            }
            else
            {
                return(View(place));
            }
        }
Esempio n. 4
0
        public ActionResult New(bp_Place place)
        {
            if (ModelState.IsValid && db.bp_Photo_GetByPlace(place.PlaceId).Count() > 0)
            {
                db.bp_Place_Create(
                    place.PlaceId,
                    (Guid)Membership.GetUser().ProviderUserKey,
                    place.CategoryId,
                    place.Title,
                    place.Latitude,
                    place.Longitude,
                    place.Descript,
                    place.PhoneNumber,
                    place.Address,
                    place.WebSite);

                return(RedirectToAction("Details", "Place", new { placeId = place.PlaceId }));
            }
            else
            {
                place.Descript = HttpUtility.HtmlDecode(place.Descript);
                return(View(place));
            }
        }