partial void DeleteUsuario(Usuario instance);
partial void UpdateUsuario(Usuario instance);
private void detach_Usuarios(Usuario entity) { this.SendPropertyChanging(); entity.aspnet_User = null; }
partial void InsertUsuario(Usuario instance);
public ActionResult Register(RegisterModel model) { if (ModelState.IsValid) { // Attempt to register the user 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_UsersInRole rel = new aspnet_UsersInRole() { RoleId = IdRol, UserId = IdUs }; db.aspnet_UsersInRoles.InsertOnSubmit(rel); string email = db.aspnet_Memberships.Where(a => a.UserId == IdUs).Select(a => a.Email).ToArray()[0]; string pwd = db.aspnet_Memberships.Where(a => a.UserId == IdUs).Select(a => a.Password).ToArray()[0]; string nick = db.aspnet_Users.Where(a => a.UserId == IdUs).Select(a => a.UserName).ToArray()[0]; Usuario NuevoUsuario = new Usuario() { UserId = IdUs, //Nick = nick, //Password = pwd, //Email = email, Karma = 0 }; db.Usuarios.InsertOnSubmit(NuevoUsuario); db.SubmitChanges(); 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); }