コード例 #1
0
        public ActionResult Create(UserProfile userprofile)
        {
            if (ModelState.IsValid)
            {
                db.UserProfiles.AddObject(userprofile);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(userprofile);
        }
コード例 #2
0
 public ActionResult Edit(UserProfile userprofile)
 {
     if (ModelState.IsValid)
     {
         db.UserProfiles.Attach(userprofile);
         db.ObjectStateManager.ChangeObjectState(userprofile, EntityState.Modified);
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(userprofile);
 }
コード例 #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the UserProfiles EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToUserProfiles(UserProfile userProfile)
 {
     base.AddObject("UserProfiles", userProfile);
 }
コード例 #4
0
 /// <summary>
 /// Create a new UserProfile object.
 /// </summary>
 /// <param name="userId">Initial value of the UserId property.</param>
 /// <param name="userName">Initial value of the UserName property.</param>
 /// <param name="userEmail">Initial value of the UserEmail property.</param>
 /// <param name="userFirstName">Initial value of the UserFirstName property.</param>
 /// <param name="userFamilyName">Initial value of the UserFamilyName property.</param>
 public static UserProfile CreateUserProfile(global::System.Int32 userId, global::System.String userName, global::System.String userEmail, global::System.String userFirstName, global::System.String userFamilyName)
 {
     UserProfile userProfile = new UserProfile();
     userProfile.UserId = userId;
     userProfile.UserName = userName;
     userProfile.UserEmail = userEmail;
     userProfile.UserFirstName = userFirstName;
     userProfile.UserFamilyName = userFamilyName;
     return userProfile;
 }