Example #1
0
        public ActionResult Edit(long?view_id, string view_friendly_name, string view_name, string view_path)
        {
            using (ViewRepository view_repository = new ViewRepository())
            {
                if (view_id.HasValue)
                {
                    view_repository.Update(view_id.Value, view_friendly_name, view_name, view_path, CurrentUser.user_domain);
                }
                else
                {
                    view_id = view_repository.CreateGlobalID();

                    string new_view_name = Transliterator.Translite(view_friendly_name);

                    if (view_repository.Exists(new_view_name, CurrentUser.user_domain))
                    {
                        new_view_name = new_view_name + "-" + view_id.ToString();
                    }

                    view_repository.Create(view_id.Value, view_friendly_name, new_view_name, view_path, CurrentUser.user_domain);
                }
            }

            return(RedirectToAction("Index"));
        }