public ActionResult Details(int Id)
        {
            CheckAda();
            ApplicationUser user = GetLoggedInUser();

            if (user == null)
            {
                return(RedirectToAction("Login", "Account"));
            }
            Image imageEntity = ApplicationDBContext.Images.Find(Id);

            if (imageEntity != null)
            {
                ImageView imageView = new ImageView();
                imageView.Id          = imageEntity.Id;
                imageView.Caption     = imageEntity.Caption;
                imageView.Description = imageEntity.Description;
                imageView.DateTaken   = imageEntity.DateTaken;
                imageView.TagName     = imageEntity.Tag.Name;
                imageView.UserId      = imageEntity.User.UserName;
                imageView.Uri         = ImageStorage.ImageURI(Url, imageEntity.Id);
                LogContext.AddLogEntry(user.UserName, imageView);
                return(View(imageView));
            }
            else
            {
                return(RedirectToAction("Error", "Home", new { errid = "ImageNotFound" }));
            }
        }
        public ActionResult Details(int Id)
        {
            CheckAda();
            Image imageEntity = db.Images.Find(Id);

            if (imageEntity != null)
            {
                ImageView imageView = new ImageView();
                imageView.Id          = imageEntity.Id;
                imageView.Uri         = ImageStorage.ImageURI(Url, imageEntity.Id);
                imageView.Caption     = imageEntity.Caption;
                imageView.Description = imageEntity.Description;
                imageView.DateTaken   = imageEntity.DateTaken;
                imageView.TagName     = imageEntity.Tag.Name;
                imageView.Userid      = imageEntity.User.UserName;
                LogContext.AddLogEntry(System.Web.HttpContext.Current.User.Identity.Name.Substring(0, System.Web.HttpContext.Current.User.Identity.Name.IndexOf('@')), imageView);

                return(View(imageView));
            }

            else
            {
                // return RedirectToAction("Error", "Home", new { errid = "Details" });
                ViewBag.Message = "There is no such image available now !";
                IEnumerable <Image> images = ApprovedImages().ToList();
                ViewBag.Userid = GetLoggedInUser().Id;


                return(View("ListAll", images));
            }
        }
Exemple #3
0
        public ActionResult Details(int Id)
        {
            CheckAda();

            {
                Image imageEntity = db.Images.Find(Id);
                if (imageEntity != null)
                {
                    ImageView imageView = new ImageView();
                    imageView.Id          = imageEntity.Id;
                    imageView.Uri         = ImageStorage.ImageURI(Url, imageEntity.Id);
                    imageView.Caption     = imageEntity.Caption;
                    imageView.Description = imageEntity.Description;
                    imageView.DateTaken   = imageEntity.DateTaken;
                    imageView.TagName     = imageEntity.Tag.Name;
                    imageView.Userid      = imageEntity.UserId;

                    LogContext.AddLogEntry(GetLoggedInUser(), imageView);

                    return(View(imageView));
                }
                else
                {
                    return(RedirectToAction("Error", "Home", new { errid = "Details" }));
                }
            }
        }
        public ActionResult Details(int Id)
        {
            CheckAda();
            Image imageEnity = db.Images.Find(Id);

            if (imageEnity != null)
            {
                LogContext.AddLogEntry(GetLoggedInUser(), imageEnity);
                return(View(imageEnity));
            }
            else
            {
                return(RedirectToAction("Error", "Home", new { errid = "Details" }));
            }
        }