public ActionResult AccountsGoalAdd(Memberlist NewMember) { DateTime today = DateTime.Today; if (NewMember == null || NewMember.Age.ToString() == "" || NewMember.Weight.ToString() == "") { return(Redirect("~/Home/AccountsGoalAdd")); } else { db.Memberlists.Add(NewMember); } Personrecord pr = new Personrecord(); pr.Height = NewMember.Height; pr.Weight = NewMember.Weight; pr.Measureday = dayTime.ToString("yyyyMMdd"); db.Personrecords.Add(pr); //將剛剛用session存起來的會員資料一起存到資料庫 NewMember.Email = Session["NewMemberEmail"].ToString(); NewMember.UserName = Session["NewMemberUserName"].ToString(); NewMember.Password = Session["NewMemberPassword"].ToString(); NewMember.Startday = today.ToString("yyyyMMdd"); db.SaveChanges(); //Session["FirstUse"] = "True"; return(RedirectToAction("Index")); }
public ActionResult MemberInfo(Memberlist member) { var CookiesID = Request.Cookies["MemberID"]; if (CookiesID == null) { return(Redirect("~/Home/Login")); } var CookiesIDint = Convert.ToInt32(CookiesID.Value); var query = from o in db.Memberlists where o.MemberID == CookiesIDint select o; Memberlist Sqlmember = query.FirstOrDefault(); Sqlmember.Age = member.Age; Sqlmember.Gender = member.Gender; Sqlmember.Height = member.Height; Sqlmember.Weight = member.Weight; Sqlmember.Goal = member.Goal; Sqlmember.ActivityCoefficient = member.ActivityCoefficient; db.SaveChanges(); return(Redirect("~/Home/Setting")); }
//登入 在下方 //註冊Step1 public ActionResult Accounts() { Memberlist NewMember = new Memberlist(); return(View(NewMember)); }