Example #1
0
        public JsonResult GetProjectCost(int projectId, int matherialId, int complectationId, Guid[] options)
        {
            var result  = MainHelper.FormatPrice(MainHelper.GetProjectCost(projectId, matherialId, complectationId));
            var result1 = MainHelper.FormatPrice(MainHelper.GetProjectCost(projectId, matherialId, 1, (complectationId == 1 ? options : null)));
            var result2 = MainHelper.FormatPrice(MainHelper.GetProjectCost(projectId, matherialId, 2, (complectationId == 2 ? options : null)));
            var result3 = MainHelper.FormatPrice(MainHelper.GetProjectCost(projectId, matherialId, 3, (complectationId == 3 ? options : null)));

            return(Json(new { cost = result, cost1 = result1, cost2 = result2, cost3 = result3 }));
        }
Example #2
0
        public ActionResult ProjectsList(int?type)
        {
            var model = MainHelper._projects.Projects;

            var filter = new ProjectFilterModel();

            if (type.HasValue)
            {
                filter.Type = type.Value < 4 ? 1 : type.Value;
                switch (type.Value)
                {
                case 1:
                    filter.Matherial1 = true;
                    break;

                case 2:
                    filter.Matherial2 = true;
                    break;

                case 3:
                    filter.Matherial3 = true;
                    break;
                }
                model = model.Where(s => s.Type == filter.Type).ToList().Filter(filter);
            }

            model.ForEach(s =>
            {
                s.Price = MainHelper.GetProjectCost(s.Id, type == 2 ? 2 : 1, 0);
            });

            model = model.OrderByDescending(o => o.Index).ThenBy(o => o.Area).ToList();

            ViewBag.ProjectFilter = filter;
            return(View(model));
        }