Example #1
0
        public ActionResult UploadImage(string imgLink)
        {
            IRepositryPicture <Fly_Picture> picdao = new PictureDAO();
            int         idpic      = 0;
            Fly_Picture objPicture = picdao.getItemByUrl(imgLink);

            if (objPicture != null)
            {
                idpic = objPicture.PictureID;
            }
            else
            {
                objPicture             = new Fly_Picture();
                objPicture.OriginalURL = imgLink;
                objPicture.MimeType    = imgLink.Substring(imgLink.Length - 3);
                objPicture.IsNew       = true;
                picdao.Add(objPicture);
                idpic = objPicture.PictureID;
            }
            return(Json(new { id = idpic }));
        }