コード例 #1
0
 public ActionResult New(tUser user)
 {
     if (user == null)
     {
         return(View("New"));
     }
     else
     {
         dbAlbumDemoEntities db = new dbAlbumDemoEntities();
         db.tUser.Add(user);
         db.SaveChanges();
         return(View("Login"));
     }
 }
コード例 #2
0
        public ActionResult Upload(tAlbum t,HttpPostedFileBase photo)
        {
            if ((t == null)|(photo==null))
                Response.Redirect("Upload");
            
            dbAlbumDemoEntities db = new dbAlbumDemoEntities();
            string photoname = Guid.NewGuid().ToString() + ".jpg";
            t.fPath = "../Content/img/" + photoname;
            photo.SaveAs(Server.MapPath("../Content/img/" + photoname));

            db.tAlbum.Add(t);
            db.SaveChanges();

            return View("../Home/Index");
        }