private void detach_aspnet_UsersInRoles(aspnet_UsersInRoles entity)
		{
			this.SendPropertyChanging();
			entity.aspnet_Roles = null;
		}
 partial void Deleteaspnet_UsersInRoles(aspnet_UsersInRoles instance);
 partial void Updateaspnet_UsersInRoles(aspnet_UsersInRoles instance);
 partial void Insertaspnet_UsersInRoles(aspnet_UsersInRoles instance);
		private void attach_aspnet_UsersInRoles(aspnet_UsersInRoles entity)
		{
			this.SendPropertyChanging();
			entity.aspnet_Users = this;
		}
        public ActionResult Register(RegisterModel model)
        {
            if (ModelState.IsValid)
            {
                // Intento de registrar al usuario
                MembershipCreateStatus createStatus;
                Membership.CreateUser(model.UserName, model.Password, model.Email, null, null, true, null, out createStatus);

                if (createStatus == MembershipCreateStatus.Success)
                {
                    DataClasses1DataContext db = new DataClasses1DataContext();
                    System.Guid idus = db.aspnet_Users.Where(a => a.UserName == model.UserName).Select(a => a.UserId).ToArray()[0];
                    System.Guid idrol = db.aspnet_Roles.Where(a => a.RoleName == "usuario").Select(a => a.RoleId).ToArray()[0];
                    aspnet_UsersInRoles rel = new aspnet_UsersInRoles() { RoleId = idrol, UserId = idus };
                    db.aspnet_UsersInRoles.InsertOnSubmit(rel);
                    db.SubmitChanges();

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

            // Si llegamos a este punto, es que se ha producido un error y volvemos a mostrar el formulario
            return View(model);
        }