Ejemplo n.º 1
0
        public ActionResult Upload(long Id, HttpPostedFileBase file)
        {
            string path = Server.MapPath("~/imgRepo/PostRepo/" + Id + file.FileName);

            PostPictures p = new PostPictures();

            p.PostId   = Id;
            p.FileName = Id + file.FileName;

            db.PostPicture.Add(p);
            db.SaveChanges();
            file.SaveAs(path);

            return(RedirectToAction("Index", "News"));
        }
Ejemplo n.º 2
0
 public int AddPosts(PostPictures item)
 {
     context.PostPicture.Add(item);
     return(context.SaveChanges());
 }