예제 #1
0
        public ActionResult Exterior()
        {
            ViewBag.BodyCssClass = "design-exterior";

            if (CurrentProject == null)
            {
                return(RedirectToAction("Home", "Projects"));
            }

            using (var dtx = new HeimContext()) {
                Project project = CurrentProject;

                var query = from asset in dtx.Assets
                            orderby asset.Name
                            select asset;

                var groups = from asset in query.ToList()
                             group new AssetViewModel {
                    ID              = asset.ID,
                    Name            = asset.Name,
                    Mapping         = asset.Mapping,
                    Created         = asset.Created,
                    Updated         = asset.Updated,
                    PreviewFilePath = asset.PreviewFilePath,
                    AssetType       = asset.AssetType,
                    AssetFilePath   = asset.AssetFilePath,
                } by asset.AssetType into assetGroup
                select assetGroup;
                groups = groups.ToList();

                foreach (var group in groups)
                {
                    foreach (var item in group)
                    {
                        item.Selected = true;
                        break;
                    }
                }

                var vm = new ExteriorViewModel {
                    Project     = CurrentProject,
                    ProjectName = project.Name,
                    ProjectID   = project.ID,
                    Assets      = groups,
                    Floors      = project.PlanTemplate.Floors
                };

                return(View(vm));
            }
        }
예제 #2
0
        public ActionResult Exterior()
        {
            ViewBag.BodyCssClass = "design-exterior";

            if(CurrentProject == null) {
                return RedirectToAction("Home", "Projects");
            }

            using(var dtx = new HeimContext()) {

                Project project = CurrentProject;

                var query = from asset in dtx.Assets
                            orderby asset.Name
                            select asset;

                var groups = from asset in query.ToList()
                             group new AssetViewModel{
                                ID = asset.ID,
                                Name = asset.Name,
                                Mapping = asset.Mapping,
                                Created = asset.Created,
                                Updated = asset.Updated,
                                PreviewFilePath = asset.PreviewFilePath,
                                AssetType = asset.AssetType,
                                AssetFilePath = asset.AssetFilePath,
                            } by asset.AssetType into assetGroup
                            select assetGroup;
                groups = groups.ToList();

                foreach(var group in groups) {
                    foreach(var item in group) {
                        item.Selected = true;
                        break;
                    }
                }

                var vm = new ExteriorViewModel {
                    Project = CurrentProject,
                    ProjectName = project.Name,
                    ProjectID = project.ID,
                    Assets = groups,
                    Floors = project.PlanTemplate.Floors
                };

                return View(vm);
            }
        }