示例#1
0
        public ActionResult GallaryPhotos(PhotoUploadGallary add, HttpPostedFileBase File)
        {
            Gallary.Upload_Photo_Gallary(add, File);

            //Message
            TempData["msg"] = "<script>alert('Upload Photos Successfully');</script>";



            //Current Url Redirect

            return(Redirect(HttpContext.Request.UrlReferrer.AbsoluteUri));


            // return View();
        }
示例#2
0
        //Add Photo
        public bool Upload_Photo_Gallary(PhotoUploadGallary upload, HttpPostedFileBase File)
        {
            string filename  = Path.GetFileNameWithoutExtension(File.FileName);
            string extension = Path.GetExtension(File.FileName);

            filename         = filename + DateTime.Now.ToString("yymmssfff") + extension;
            upload.ImagePath = "~/Content/Image/GallaryPhoto/" + filename;
            filename         = Path.Combine(System.Web.HttpContext.Current.Server.MapPath("~/Content/Image/GallaryPhoto/"), filename);
            upload.Shared    = "public";
            File.SaveAs(filename);


            Db.Set <PhotoUploadGallary>().Add(upload);
            Db.SaveChanges();
            return(true);
        }
示例#3
0
 //Update Gallary Photo
 public bool UpdateGallaryPhoto(PhotoUploadGallary UpdatePhoto)
 {
     Db.Entry(UpdatePhoto).State = EntityState.Modified;
     Db.SaveChanges();
     return(true);
 }