Ejemplo n.º 1
0
        public ActionResult ContentTemplatesEdit(BackEndContentTemplatesEdit backEndContentTemplatesEdit, int id)
        {
            ContentTemplates contentTemplates = new ContentTemplates();
            int?result = contentTemplates.Edit(id, backEndContentTemplatesEdit.Title, backEndContentTemplatesEdit.Description, backEndContentTemplatesEdit.Content, backEndContentTemplatesEdit.IsActive);

            switch (result)
            {
            case 0:

                ModelState.AddResult(ViewData, ModelStateResult.Success, Resources.Strings.ItemSuccessfullyEdited);
                break;

            case 2:
                ModelState.AddResult(ViewData, ModelStateResult.Error, Resources.Strings.ItemDoesNotExist);
                ViewData.IsFormVisible(false);
                break;

            case 3:
                ModelState.AddResult(ViewData, ModelStateResult.Error, Resources.Strings.ContentTemplateTitleAlreadyExists);
                break;

            default:
                ModelState.AddResult(ViewData, ModelStateResult.Error, Resources.Strings.UnexpectedError);
                break;
            }

            return(View(backEndContentTemplatesEdit));
        }
Ejemplo n.º 2
0
        public ActionResult ContentTemplatesEdit(int id)
        {
            BackEndContentTemplatesEdit backEndContentTemplatesEdit = new BackEndContentTemplatesEdit();

            ContentTemplate contentTemplate = new ContentTemplates().GetContentTemplateById(id);

            if (contentTemplate.IsNotNull())
            {
                backEndContentTemplatesEdit.Title       = contentTemplate.title;
                backEndContentTemplatesEdit.Description = contentTemplate.description;
                backEndContentTemplatesEdit.Content     = contentTemplate.content;
                backEndContentTemplatesEdit.IsActive    = contentTemplate.IsActive;
            }
            else
            {
                ModelState.AddResult(ViewData, ModelStateResult.Error, Resources.Strings.ItemDoesNotExist);
                ViewData.IsFormVisible(false);
            }

            return(View(backEndContentTemplatesEdit));
        }