public ActionResult Users_Destroy([DataSourceRequest]DataSourceRequest request, Organization organization) { this.organizations.Delete(organization.Id); return this.Json(new[] { organization }.ToDataSourceResult(request, this.ModelState)); }
public void Delete(Organization model) { this.organizatons.Delete(model); this.organizatons.Save(); }
public async Task<ActionResult> RegisterOrganization(RegisterOrganizationViewModel model) { if (this.ModelState.IsValid) { var user = new Organization { UserName = model.UserName, Email = model.Email, Description = model.Description, Name = model.Name, Address = model.Address, CreatedOn = DateTime.UtcNow, Image = model.Image }; var result = await this.UserManager.CreateAsync(user, model.Password); if (result.Succeeded) { await this.SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false); if (!this.RoleManager.RoleExists(RoleConstants.OrganizationRoleConstant)) { var role = new IdentityRole { Name = RoleConstants.OrganizationRoleConstant }; this.RoleManager.Create(role); } await this.UserManager.AddToRoleAsync(user.Id, RoleConstants.OrganizationRoleConstant); // For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=320771 // Send an email with this link // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id); // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme); // await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>"); return this.RedirectToAction("Index", "Home"); } this.AddErrors(result); } // If we got this far, something failed, redisplay form return this.View("Register", model); }
public void Add(Organization model) { this.organizatons.Add(model); this.organizatons.Save(); }