Ejemplo n.º 1
0
        public ActionResult BlogDetail(int?id, string cC)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Blog blog = db.Blogs.Find(id);

            Session["ID"] = id;

            //Property myaccount = db.Properties.Find(id);
            if (blog == null)
            {
                return(HttpNotFound());
            }

            ViewBag.BlogTitle     = blog.Title;
            ViewBag.CommentsCount = cC;
            MultipleModels model = new MultipleModels
            {
                Blog         = blog,
                RelatedBlogs = db.Blogs.Where(c => c.ID != id)
                               .OrderBy(c => Guid.NewGuid())
                               .Take(5).ToList(),

                BlogComments = db.BlogComments.Where(b => b.BlogId == blog.ID)
                               .OrderByDescending(c => c.DatePosted)
                               .ToList()
            };

            Session["blog_url"] = Request.Url.AbsolutePath;
            return(View(model));
        }
        public IActionResult Require(MultipleModels models)
        {
            var classroom = classroomServices.GetByClassCode(models.Classroom.ClassCode);
            var student   = userServices.GetById(userManager.GetUserId(User));

            requireServices.AddRequest(classroom, student);
            return(RedirectToAction("Index", "Home"));
        }
Ejemplo n.º 3
0
        //POST: Leave message for Agent
        public ActionResult DropMessage(MultipleModels model, string propertyName, string landlordID)
        {
            var url     = Session["url"].ToString();
            var message = new Message
            {
                SenderName    = model.MessageViewModel.SenderName,
                SenderPhoneNo = model.MessageViewModel.SenderPhoneNo,
                Email         = model.MessageViewModel.Email,
                MessageBody   = model.MessageViewModel.MessageBody,
                PropertyName  = Request.Form["Property_Name"].ToString(),
                LandlordID    = Request.Form["Landlord_ID"].ToString(),
                DateSent      = DateTime.Now.ToString(),
            };

            db.Messages.Add(message);
            db.SaveChanges();

            return(Redirect(url));
        }
        public IActionResult Index()
        {
            if (signInManager.IsSignedIn(User))
            {
                var user = userManager.GetUserAsync(User).GetAwaiter().GetResult();
                var role = userManager.GetRolesAsync(user).GetAwaiter().GetResult();
                if (role[0] == "Teacher")
                {
                    var list        = classroomServices.GetAllByID(userManager.GetUserId(User));
                    var student     = userServices.GetById(userManager.GetUserId(User));
                    var requireList = requireServices.GetAll();
                    var viewModel   = new MultipleModels()
                    {
                        classrooms = list,
                        requires   = requireList,
                        Student    = student
                    };

                    return(View(viewModel));
                }
                else
                if (role[0] == "Student")
                {
                    var requireList = requireServices.GetAcceptedRequests(userManager.GetUserId(User));
                    var viewModel   = new MultipleModels()
                    {
                        requires = requireList,
                    };

                    return(View(viewModel));
                }
            }

            else
            {
                return(View());
            }
            return(View());
        }
Ejemplo n.º 5
0
        public ActionResult PostComment(MultipleModels model)
        {
            var url = Session["blog_url"].ToString();

            int blog_id = int.Parse(Request.Form["blog_id"].ToString());

            if (ModelState.IsValid)
            {
                var comment = new BlogComment
                {
                    Name       = model.BlogCommentsViewModel.Name,
                    Content    = model.BlogCommentsViewModel.Content,
                    BlogId     = blog_id,
                    DatePosted = DateTime.Now,
                    Status     = "Shown"
                };

                db.BlogComments.Add(comment);
                db.SaveChanges();
                return(Redirect(url));
            }
            return(View("BlogDetails", model));
        }
Ejemplo n.º 6
0
        public ActionResult Index(int page = 1)
        {
            string url = Request.Url.AbsolutePath;
            ////Get property types from database and then set it to ViewBag to pass it View
            IEnumerable <SelectListItem> PropertyTypes = db.PropertyTypes.Select(c => new SelectListItem
            {
                Value = c.Name,
                Text  = c.Name,
            });

            ViewBag.PropertyTypes = PropertyTypes;

            ////Get the locations from database and then set it to ViewBag to pass it View
            IEnumerable <SelectListItem> Locations = db.Locations.Select(c => new SelectListItem
            {
                Value = c.Name,
                Text  = c.Name,
            });

            ViewBag.Locations = Locations;

            //Get the value from database and then set it to ViewBag to pass it View
            IEnumerable <SelectListItem> MinPrice = db.PriceRanges.OrderBy(c => c.Id).Select(c => new SelectListItem
            {
                Value = SqlFunctions.StringConvert(c.Amount),
                //Text = "₦" + string.Format("{0:#,0.00}", c.Amount)
                Text = c.S_Amount
            });

            ViewBag.MinPrice = MinPrice;


            //Get the value from database and then set it to ViewBag to pass it View
            IEnumerable <SelectListItem> MaxPrice = db.PriceRanges.OrderByDescending(c => c.Id).Select(c => new SelectListItem
            {
                Value = SqlFunctions.StringConvert(c.Amount),
                Text  = c.S_Amount
            });

            ViewBag.MaxPrice = MaxPrice;

            ////Get number of beds database and then set it to ViewBag to pass it View
            IEnumerable <SelectListItem> Beds = db.Beds.Select(c => new SelectListItem
            {
                Value = c.Qty,
                Text  = c.Title,
            });

            ViewBag.Beds = Beds;

            ////Get number of baths from database and then set it to ViewBag to pass it View
            IEnumerable <SelectListItem> Baths = db.Baths.Select(c => new SelectListItem
            {
                Value = c.Qty,
                Text  = c.Title,
            });

            ViewBag.Baths = Baths;

            ////Get No. of Toilets from database and then set it to ViewBag to pass it View
            IEnumerable <SelectListItem> Toilets = db.Toilets.Select(c => new SelectListItem
            {
                Value = c.Qty,
                Text  = c.Title,
            });

            ViewBag.Toilets = Toilets;

            ViewBag.Nnewi     = db.Properties.Where(l => l.Location == "Nnewi").Count();
            ViewBag.Ihiala    = db.Properties.Where(l => l.Location == "Ihiala").Count();
            ViewBag.Awka      = db.Properties.Where(l => l.Location == "Awka").Count();
            ViewBag.Onitsha   = db.Properties.Where(l => l.Location == "Onitsha").Count();
            ViewBag.Ogbunike  = db.Properties.Where(l => l.Location == "Ogbunike").Count();
            ViewBag.Nkpor     = db.Properties.Where(l => l.Location == "Nkpor").Count();
            ViewBag.Aguleri   = db.Properties.Where(l => l.Location == "Aguleri").Count();
            ViewBag.Achina    = db.Properties.Where(l => l.Location == "Achina").Count();
            ViewBag.Ekwulobia = db.Properties.Where(l => l.Location == "Ekwulobia").Count();
            ViewBag.Umunze    = db.Properties.Where(l => l.Location == "Umunze").Count();
            ViewBag.Igbariam  = db.Properties.Where(l => l.Location == "Igbariam").Count();
            ViewBag.Mbakwu    = db.Properties.Where(l => l.Location == "Mbakwu").Count();
            ViewBag.Oko       = db.Properties.Where(l => l.Location == "Oko").Count();

            var model = new MultipleModels
            {
                Blogs = db.Blogs.OrderBy(b => b.ID).Take(5).ToList(),
                FeaturedProperties = db.Properties.Where(c => c.Featured == true).Take(3),
                PropertyList       = db.Properties.OrderByDescending(c => c.PropertyID)
                                     //.Skip((page - 1) * pageSize)
                                     .Take(pageSize)
                                     .ToList()
            };

            return(View(model));
        }