Example #1
0
        public ActionResult Edit(long?block_id, string block_name, string block_friendly_name, long?[] block_templates, long?block_content_root, string block_area, string block_controller, string block_action, bool block_allow_sort, string block_order_fields)
        {
            using (BlockRepository block_repository = new BlockRepository())
            {
                if (block_id.HasValue)
                {
                    block_repository.Update(block_id.Value, block_name, block_friendly_name, (block_templates == null ? string.Empty : string.Join(",", block_templates)), block_content_root, block_area, block_controller, block_action, block_allow_sort, block_order_fields, CurrentUser.user_domain);
                }
                else
                {
                    block_id = block_repository.CreateGlobalID();

                    string new_block_name = Transliterator.Translite(block_friendly_name);

                    if (block_repository.Exists(new_block_name, CurrentUser.user_domain))
                    {
                        new_block_name = new_block_name + "-" + block_id.ToString();
                    }

                    block_repository.Create(block_id.Value, new_block_name, block_friendly_name, (block_templates == null ? string.Empty : string.Join(",", block_templates)), block_content_root, block_area, block_controller, block_action, block_allow_sort, block_order_fields, false, CurrentUser.user_domain);
                }
            }

            return(RedirectToAction("Index"));
        }
Example #2
0
        public ActionResult AddSeparate()
        {
            string block_friendly_name = "Разделитель";

            using (BlockRepository block_repository = new BlockRepository())
            {
                long block_id = block_repository.CreateGlobalID();

                string new_block_name = Transliterator.Translite(block_friendly_name);

                if (block_repository.Exists(new_block_name, CurrentUser.user_domain))
                {
                    new_block_name = new_block_name + "-" + block_id.ToString();
                }

                block_repository.Create(block_id, new_block_name, block_friendly_name, string.Empty, null, null, null, null, false, string.Empty, true, CurrentUser.user_domain);
            }

            return(RedirectToAction("Index"));
        }