public async Task <ActionResult> Register(RegisterEditModel model) { if (ModelState.IsValid) { var user = new IdentityUser { UserName = model.UserName, Name = model.Name, Email = model.Email }; var organizer = new Organizer { OrganizerId = Guid.NewGuid(), Name = user.Name, Description = string.Format("{0} kullanıcısının organizatör profili.", user.Name), Image = PlaceholderImagePath, IsDefault = true }; organizer.Slug = string.Format("o-{0}", organizer.OrganizerId.ToString("N")); user.Organizers.Add(organizer); var result = await _userManager.CreateAsync(user, model.Password); if (result.Succeeded) { await SignInAsync(user, false); return(RedirectToAction("Index", "Home")); } AddErrors(result); } return(View(model)); }
public virtual ActionResult Register(RegisterEditModel model) { if (!ModelState.IsValid) { return(View(model)); } var user = model.AsUser(); if (_userService.AddUser(user).Id <= 0) { return(View(model)); } var adminCookie = new HttpCookie("ChiakiCookie" + user.UserName) { Value = UserPasswordHelper.MD5(true.ToString()) }; if (!string.IsNullOrEmpty(FormsAuthentication.CookieDomain)) { adminCookie.Domain = FormsAuthentication.CookieDomain; } adminCookie.HttpOnly = true; Response.Cookies.Add(adminCookie); FormsAuthentication.SetAuthCookie(model.UserName, false); return(RedirectToAction(MVC.Channel.Home())); }