Example #1
0
 public ActionResult Activate(ContentLibraryViewModel model)
 {
     try
     {
         var content = Db.ContentLibraries.FirstOrDefault(c => c.Id == model.Id);
         if (content == null)
         {
             return(new HttpNotFoundResult("Content item was not found"));
         }
         content.Status = ContentStatus.Active;
         Db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View(model));
     }
 }
Example #2
0
        private ContentLibraryViewModel ContentToViewModel(ContentLibrary content, bool gridView)
        {
            var result = new ContentLibraryViewModel
            {
                ContentType     = content.ContentType.ToString(),
                Status          = content.Status,
                Id              = content.Id,
                Created         = content.Created?.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss") ?? "",
                Featured        = content.Featured,
                Precis          = content.Precis,
                ImageUrl        = MakeImageUrl(content.ImageUrl, gridView),
                Title           = content.Title,
                Url             = content.Url,
                ContentTypeText = content.ContentType.ToString(),
                StatusText      = content.Status.ToString()
            };

            return(result);
        }