Exemplo n.º 1
0
        /// <summary>
        /// Entry point for landlord to manage a single property.
        /// </summary>
        /// <param name="id">the property identifier</param>
        /// <returns></returns>
        public ActionResult Manage(long id, Guid?token)
        {
            if (!User.Identity.IsAuthenticated && token.HasValue)
            {
                var user = authAdapter.ValidateAuthToken(token.Value);
                if (user.StatusCode == 200)
                {
                    CustomAuthentication.SetAuthCookie(user.Result.Username, user.Result.UserId, true);
                }
                return(Redirect("/property/manage/" + id));
            }

            if (!User.Identity.IsAuthenticated)
            {
                return(Redirect("/account/login?returnUrl=" + "/property/manage/" + id));
            }

            var listing = this.propertyFacade.ManageListingById(id);

            if (listing.StatusCode != 200)
            {
                throw new HttpException(404, "Not Found");
            }
            PropertyManageModel model = new PropertyManageModel();

            model.Listing = listing.Result;
            if (!model.Listing.IsValidListing)
            {
                return(View("Manage-NotValid", model));
            }
            return(View(model));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Entry point for landlord to manage a single property
        /// </summary>
        /// <param name="id">the property identifier</param>
        /// <returns></returns>
        public ActionResult Manage(long id)
        {
            var status = this.propertyAdapter.GetProperty(id, User.Identity.Name);

            if (status.StatusCode != 200)
            {
                return(RedirectToAction("index", "home", new { area = "landlord" }));
            }

            PropertyManageModel model = new PropertyManageModel();

            model.Building = status.Result;

            var countStatus       = this.propertyAdapter.GetListingViews(id);
            var searchCountStatus = this.propertyAdapter.GetListingSearchViews(id);

            model.ViewCount       = countStatus.Result;
            model.SearchViewCount = searchCountStatus.Result;

            return(View(model));
        }