public JsonResult UploadPreImage(HttpPostedFileWrapper qqfile)
 {
     _photoEditor = new PhotoEditor(UrlToLocal(TempFolder), UrlToLocal(JewelPHotoFolder));
     try
     {
         var fName=_photoEditor.SaveTempFile(qqfile);
         return Json(new { success = true, errorMessage = string.Empty, fileName = "/Content/images/Temp" + "/" + fName });
     }
     catch (Exception e)
     {
         return Json(new {success = true, errorMessage = e.Message});
     }
 }
        public ActionResult Save(string t, string l, string h, string w, string fileName, string caption)
        {
            if ((!string.IsNullOrEmpty(fileName)) && (!string.IsNullOrEmpty(caption)))
            {
                int top = Convert.ToInt32(t.Replace("-", "").Replace("px", ""));
                int left = Convert.ToInt32(l.Replace("-", "").Replace("px", ""));
                int height = Convert.ToInt32(h.Replace("-", "").Replace("px", ""));
                int width = Convert.ToInt32(w.Replace("-", "").Replace("px", ""));
                try
                {
                    _photoEditor = new PhotoEditor(UrlToLocal(TempFolder), UrlToLocal(JewelPHotoFolder));
                    string name =  _photoEditor.SaveJevelPhot(top, left, height, width, UrlToLocal(fileName));

                    var photo = new JewelPHoto {Name = name, Caption = caption};
                    db.JewelPHotos.Add(photo);
                    db.SaveChanges();

                    return Json(new {success = true, errorMessage = string.Empty});
                }
                catch (Exception e)
                {
                    return Json(new {success = false, errorMessage = e.Message});
                }
            }
            return Json(new {success = false, errorMessage = "Произошла ошибка при попытке сохранения изображения."});
        }