Esempio n. 1
0
 protected void Application_Start()
 {
     ModelBinderProviders.BinderProviders.Add(new ModelBinderProvider());
     AreaRegistration.RegisterAllAreas();
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RoutingFactory.RegisterRoutes(RouteTable.Routes);
 }
 public ActionResult Edit([Bind(Include = "Id,Name,Description,Slug,CreatorUserId,CreateDateTime,LastModifierByUserId,LastModifyDateTime,IsActive")] EventCategory eventCategory)
 {
     if (ModelState.IsValid)
     {
         AddModificationInfo(eventCategory);
         Db.EventCategories.AddOrUpdate(eventCategory);
         Db.SaveChanges();
         RoutingFactory.RegisterRoutes(RouteTable.Routes);
         return(RedirectToAction("Index"));
     }
     return(View(eventCategory));
 }
        public ActionResult Create([Bind(Include = "Id,Name,Slug,CreatorUserId,CreateDateTime,LastModifierByUserId,LastModifyDateTime,IsActive")] ContentCategory contentCategory)
        {
            if (ModelState.IsValid)
            {
                AddCreationInfo(contentCategory);
                Db.ContentCategories.Add(contentCategory);
                Db.SaveChanges();
                RoutingFactory.RegisterRoutes(RouteTable.Routes);
                return(RedirectToAction("Index"));
            }

            return(View(contentCategory));
        }
Esempio n. 4
0
 public ActionResult Edit([Bind(Include = "Id,Title,Description,Body,CategoryId,Slug,CreatorUserId,CreateDateTime,LastModifierByUserId,LastModifyDateTime,IsActive")] Models.Content content)
 {
     if (ModelState.IsValid)
     {
         AddModificationInfo(content);
         Db.Contents.AddOrUpdate(content);
         Db.SaveChanges();
         RoutingFactory.RegisterRoutes(RouteTable.Routes);
         return(RedirectToAction("Index"));
     }
     ViewBag.CategoryId = new SelectList(Db.ContentCategories, "Id", "Name", content.CategoryId);
     return(View(content));
 }
 public ActionResult Edit([Bind(Include = "Id,Name,ShortDescription,Description,EventDate,Location,LocationCoordinates,CategoryId,Slug,CreatorUserId,CreateDateTime,LastModifierByUserId,LastModifyDateTime,IsActive")] Event @event, string imagePath = null)
 {
     if (ModelState.IsValid)
     {
         AddModificationInfo(@event);
         Db.Events.AddOrUpdate(@event);
         Db.SaveChanges();
         if (!string.IsNullOrWhiteSpace(imagePath))
         {
             @event.ImageSave(imagePath, EntityImageFormat.Original, EntityImageFormat.Cover, EntityImageFormat.Icon);
         }
         RoutingFactory.RegisterRoutes(RouteTable.Routes);
         return(RedirectToAction("Index"));
     }
     ViewBag.CategoryId = new SelectList(Db.EventCategories, "Id", "Name", @event.CategoryId);
     return(View(@event));
 }