/// <summary>
 /// Deprecated Method for adding a new object to the contacts EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTocontacts(contact contact)
 {
     base.AddObject("contacts", contact);
 }
示例#2
0
        public ActionResult Register(RegisterModel model)
        {
            if (ModelState.IsValid)
            {
                // Attempt to register the user
                contact c = new contact();
                c.username = model.UserName;
                c.email = model.Email;
                c.password = model.Password;
                db.contacts.AddObject(c);
                db.SaveChanges();

                //MembershipCreateStatus createStatus;
               // Membership.CreateUser(model.UserName, model.Password, model.Email, null, null, true, null, out createStatus);

                //if (createStatus == MembershipCreateStatus.Success)
                {
                    FormsAuthentication.SetAuthCookie(model.UserName, false /* createPersistentCookie */);
                    return RedirectToAction("Index", "Home");
                }
                /*else
                {
                    ModelState.AddModelError("", ErrorCodeToString(createStatus));
                }*/
            }

            // If we got this far, something failed, redisplay form
            return View(model);
        }
 /// <summary>
 /// Create a new contact object.
 /// </summary>
 /// <param name="id">Initial value of the id property.</param>
 public static contact Createcontact(global::System.Int64 id)
 {
     contact contact = new contact();
     contact.id = id;
     return contact;
 }