_contentManager.UpdateEditor return error

Topics: Customizing Orchard
Nov 17, 2011 at 7:58 PM

Hi,

Here is my createpost code

 public ActionResult CreatePOST()
        {
            if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to manage Categories")))
                return new HttpUnauthorizedResult();

            var Category = Services.ContentManager.New<CategoryPart>("Category");

            _contentManager.Create(Category, VersionOptions.Published);
            dynamic model = _contentManager.UpdateEditor(Category, this);

            if (!ModelState.IsValid)
            {
                _transactionManager.Cancel();
                // Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
               // return View((object)model);
                return View ();
            }

            _contentManager.Publish(Category.ContentItem);
            //_blogPathConstraint.AddPath(blog.As<IRoutableAspect>().Path);

            return Redirect(Url.Content("Category/admin"));
        }

 dynamic model = _contentManager.UpdateEditor(Category, this);

This line return error
Error 1 The best overloaded method match for 'Orchard.ContentManagement.IContentManager.UpdateEditor(Orchard.ContentManagement.IContent, Orchard.ContentManagement.IUpdateModel, string)' has some invalid arguments E:\Arruni\Arruni\Sean Baumann\Orchard\src\Orchard.Web\Modules\eProp.Category\Controllers\AdminController.cs 142 29 eProp.Category

But i copy code from blogadmincontroller, At blogadmin code is working. Only my controller its not working

lakmal



Nov 17, 2011 at 8:03 PM

Your controller needs to implement IUpdateModel, you can see the implementation towards the end of BlogController (TryUpdateModel and AddModelError)