예제 #1
0
        public ActionResult Create(FormCollection formData)
        {
            SubsiteCreateDto       instance = new SubsiteCreateDto();
            SubsiteCreateViewModel model    = new SubsiteCreateViewModel(instance);

            UpdateModel(instance, formData);
            if (ModelState.IsValid)
            {
                int sort = 201;
                if (!instance.DefaultLanguageId.HasValue)
                {
                    instance.DefaultLanguageId = CmsRegister.MIN_LANGUAGE_ID;
                }
                int locationId = CmsRegister.MIN_LOCATION_ID;
                if (instance.DefaultLocationId != null)
                {
                    locationId = instance.DefaultLocationId.Value;
                }
                int            categoryId = CmsRegister.MAX_CATEGORY_ID;
                FolderTreeData tree       = CreateFolderTreeOfSupplier(instance.Name, instance.ServiceLandingName, instance.ServiceLandingSlug, instance.EventLandingName, instance.EventLandingSlug, CmsRegister.CONTENT_FOLDER_ID, sort, categoryId, locationId, false);
                IFacadeUpdateResult <FolderData> result = Service.SaveSubsiteWhole(tree, Convert(instance));
                if (result.IsSuccessful)
                {
                    return(RedirectToAction(IndexAction));
                }
                else
                {
                    ProcUpdateResult(result.ValidationResult, result.Exception);
                }
            }

            return(View(model));
        }
예제 #2
0
        public ActionResult Create()
        {
            SubsiteCreateDto       instance = new SubsiteCreateDto();
            SubsiteCreateViewModel model    = new SubsiteCreateViewModel(instance);

            return(View(model));
        }
예제 #3
0
        private SubsiteDto Convert(SubsiteCreateDto instance)
        {
            SubsiteDto result = new SubsiteDto()
            {
                Name              = instance.Name,
                Address           = instance.Address,
                Phone             = instance.Phone,
                Fax               = instance.Fax,
                Email             = instance.Email,
                Website           = instance.Website,
                BackColor         = "#f0f0f0",
                TitleColor        = "#292929",
                BannerHeight      = 40,
                IsPublished       = instance.IsPublished,
                DefaultLanguageId = instance.DefaultLanguageId,
                DefaultLocationId = instance.DefaultLocationId
            };

            return(result);
        }
예제 #4
0
 public SubsiteCreateViewModel(SubsiteCreateDto instance)
     : base(InstanceTypes.SubsiteCreate, instance)
 {
     PageTitle = string.Format("Create New {0}:", Subject.SubjectLabel);
     IsEditing = true;
 }