Example #1
0
        public ActionResult AddReview(HousingPost post)
        {
            LocalHousingModule housingModule = new LocalHousingModule();
            string username = "";
            if (User != null && User.Identity != null)
                username = User.Identity.Name;
            housingModule.AddHousingPost(post, User.Identity.Name);

            return RedirectToAction("Index");
        }
Example #2
0
        public ActionResult RemoveReview(int postID)
        {
            LocalHousingModule housingModule = new LocalHousingModule();
            HousingPost post = housingModule.GetHousingPost(postID);

            if (User.IsInRole("admin") || User.Identity.Name.Equals(post.PostedBy))
            {
                housingModule.DeleteHousingPost(postID);
            }
            else
            {
                throw new HttpException(403, "Access Denied");
            }

            return null;
        }