示例#1
0
        public virtual System.Web.Mvc.ActionResult Edit(Models.Contents Content)
        {
            Models.Contents originalItem =
                MyDatabaseContext.Contents.Find(Content.Id);

            if (originalItem == null)
            {
                return(HttpNotFound());
            }

            if (ModelState.IsValid)
            {
                originalItem.Annotatedtext = Content.Annotatedtext;
                originalItem.ImageUrl      = Content.ImageUrl;
                originalItem.IsActive      = Content.IsActive;
                originalItem.ReviewTime    = System.DateTime.Now;
                originalItem.Text          = Content.Text;
                originalItem.Title         = Content.Title;

                MyDatabaseContext.SaveChanges();

                return(RedirectToAction(MVC.Users.Products.Index()));
            }

            return(View(model: Content));
        }
示例#2
0
        public virtual System.Web.Mvc.ViewResult Create()
        {
            Models.Contents defaultItem = new Models.Contents();

            defaultItem.IsActive = true;

            return(View(model: defaultItem));
        }
        public override System.Web.Mvc.ActionResult Edit(Models.Contents Content)
        {
            var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Edit);

            ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "Content", Content);
            EditOverride(callInfo, Content);
            return(callInfo);
        }
示例#4
0
 internal static Storing.Contents Map(Models.Contents contents)
 {
     if (contents == null)
     {
         return(null);
     }
     return(new Storing.Contents()
     {
         Id = contents.Id,
         Content = contents.Content,
         Level = contents.Level
     });
 }
示例#5
0
        Create([System.Web.Mvc.Bind(Exclude = "Id")] Models.Contents Content)
        {
            Infrastructure.RenderViews Render =
                new Infrastructure.RenderViews();

            Content.CodePath = Render.TextRightOfImage(Content.MatterId, Content.ImageUrl, Content.Title, Content.Text);

            if (ModelState.IsValid)
            {
                Content.ReviewTime = System.DateTime.Now;

                MyDatabaseContext.Contents.Add(Content);

                MyDatabaseContext.SaveChanges();

                return(RedirectToAction(MVC.Users.Products.Index()));
            }

            return(View(model: Content));
        }
 partial void EditOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, Models.Contents Content);