Ejemplo n.º 1
0
 public CCLayout Savelayout(CCLayout layoutObj)
 {
     context.CCLayouts.Add(layoutObj);
     context.SaveChanges();
     return layoutObj;
 }
        public ActionResult ManageLayoutsAndGroups(long ID)
        {
            TempData["SelectedMenu"] = "ManageFolders";
            ManageLayoutsAndGroupsViewModel manageLayoutsAndGroups = new ManageLayoutsAndGroupsViewModel();
            Account accountObj = (Account)Session["account"];

            var groups = CCGroupRepository.CCGroups.Where(u => u.FolderID == ID & u.AccountGUID == accountObj.AccountGUID).ToList();
            manageLayoutsAndGroups.Groups = groups;

            var layouts = CCLayoutRepository.CCLayouts.Where(u => u.FolderID == ID & u.AccountGUID == accountObj.AccountGUID).ToList();
            if (layouts.Count == 0)
            {
                List<CCLayout> layoutlist = new List<CCLayout>();
                CCLayout layoutobj = new CCLayout();
                layoutobj.FolderID = ID;
                layoutobj.LayoutID = 0;
                layoutobj.LayoutName = "empty";
                layoutlist.Add(layoutobj);
                manageLayoutsAndGroups.Layouts = layoutlist;
            }
            else
            {
                manageLayoutsAndGroups.Layouts = layouts;
            }

            var folderNmae = CCFolderRepository.CCFolders.Where(fid => fid.FolderID == ID & fid.AccountGUID == accountObj.AccountGUID).FirstOrDefault().Name;
            manageLayoutsAndGroups.FolderName = folderNmae;

            return View(manageLayoutsAndGroups);
        }