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")); } }
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"); }