예제 #1
0
 public ActionResult Create(Guid id)
 {
     SiteMapItem parentSiteNode = GetSiteMapItem(id);
     var model = new CompanyCreateModel
                     {
                         DisplayOnSideMenu = true,
                         IsActive = true,
                         LogoUrl = _logoManager.GetPath(String.Empty),
                         ParentTitle = parentSiteNode.Title,
                         ParentUrl = parentSiteNode.Url,
                         SortOrder = 500,
                         Title = "Новая организация"
                     };
     return View(model);
 }
예제 #2
0
        public ActionResult Create(Guid id, CompanyCreateModel model)
        {
            SiteMapItem parentNode = GetSiteMapItem(id);

            if (!ModelState.IsValid)
            {
                model.ParentTitle = parentNode.Title;
                model.ParentUrl = parentNode.Url;
                return View(model);
            }

            string companyUrl =
                BusinessShell.RunWithResult(
                    () =>
                    new AddCompanyOperation(model.Abstract, User.Identity.Name, model.IsActive, id, model.Text ?? String.Empty,
                                            model.Title,
                                            _logoManager.GetFileName(model.LogoUrl),
                                            model.PhoneNumber ?? string.Empty, model.Address ?? String.Empty,
                                            model.Email ?? String.Empty, model.Hyperlink ?? String.Empty,
                                            model.DisplayOnMainMenu, model.DisplayOnSideMenu, model.SortOrder,
                                            "/company/display/{0}"));
            return Redirect(companyUrl);
        }