Esempio n. 1
0
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            try
            {
                var tags    = filterContext.Controller.ValueProvider.GetValue("alttag").AttemptedValue.Split(',');
                var photoid = filterContext.Controller.ValueProvider.GetValue("photoid").AttemptedValue.Split(',');
                for (int i = 0; i < tags.Count(); i++)
                {
                    PhotoManager.Edit(Convert.ToInt32(photoid[i]), tags[i], null, "", "");
                }
            }
            catch (Exception)
            {
            }

            base.OnActionExecuting(filterContext);
        }
Esempio n. 2
0
        public ActionResult Edit(Photo Photomodel, HttpPostedFileBase uploadfile, string language)
        {
            var languages = LanguageManager.GetLanguages();
            var list      = new SelectList(languages, "Culture", "Language");

            ViewBag.LanguageList = list;

            if (ModelState.IsValid)
            {
                //if (uploadfile != null && uploadfile.ContentLength > 0)
                //{
                //    using (System.Drawing.Image image = System.Drawing.Image.FromStream(uploadfile.InputStream, true, true))
                //    {
                //        if (image.Width == 1440 && image.Height == 450)
                //        {
                //            Random random = new Random();
                //            int rand = random.Next(1000, 99999999);
                //            new ImageHelper(1440, 1440).SaveThumbnail(uploadfile, "/Content/images/Photos/", Utility.SetPagePlug("banner") + "_" + rand + Path.GetExtension(uploadfile.FileName));
                //            Photomodel.Path = "/Content/images/Photos/" + Utility.SetPagePlug("banner") + "_" + rand + Path.GetExtension(uploadfile.FileName);
                //            TempData["ImageSizeError"] = null;
                //        }
                //        else
                //        {
                //            TempData["ImageSizeError"] = "Eklemiş olduğunuz resmin boyutları 1440x450 olmalıdır...";
                //            return View();
                //        }
                //    }
                //}

                if (Session["ModifiedImageId"] != null)
                {
                    Photomodel.Path = "/Content/images/userfiles/news/" + Session["ModifiedImageId"].ToString() + Session["WorkingImageExtension"].ToString();
                    ImageHelperNew.DestroyImageCashAndSession(0, 0);
                }

                if (RouteData.Values["id"] != null)
                {
                    int  nid      = 0;
                    bool isnumber = int.TryParse(RouteData.Values["id"].ToString(), out nid);
                    if (isnumber)
                    {
                        Photomodel.PhotoId     = nid;
                        ViewBag.ProcessMessage = PhotoManager.Edit(nid, Photomodel.Title, Photomodel.Path, Photomodel.Link, language);
                        return(View(Photomodel));
                    }
                    else
                    {
                        ViewBag.ProcessMessage = false;
                        return(View(Photomodel));
                    }
                }
                else
                {
                    return(View());
                }
            }
            else
            {
                return(View());
            }
        }