public ActionResult GetObject(int id)
 {
     try
     {
         ImagesModel ImagesObj = ImagesFactor.GetObject(id);
         if (ImagesObj == null)
         {
             ImagesObj = new ImagesModel();
         }
         return(Json(ImagesObj, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         return(new HttpStatusCodeResult(HttpStatusCode.InternalServerError, ex.Message));
     }
 }
        //***********************************************************************************************
        #endregion

        public ActionResult Image(int imageId, int width, int height)
        {
            ImagesModel  image = ImagesFactor.GetObject(imageId);
            MemoryStream ms    = new MemoryStream(image.Data);

            byte[] imageContent = ThumbnailsManager.CreateThumb(ms, width, height, ThumbnailsManager.Quality);
            ////Image img = Image.FromStream(ms);
            //// return byte array to caller with image type
            //Random rnd = new Random();
            //int month = rnd.Next(1, 1000000);
            //Response.ContentType = "image/jpeg";
            //Response.AddHeader("Content-disposition", "attachment; filename=" + month + ".jpg");
            //Response.BinaryWrite(imageContent);



            return(File(imageContent, "image/jpg"));
        }