Guest User

Untitled

a guest
May 19th, 2018
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. public ActionResult CreateUser(string Email,string Password)
  2. {
  3. try
  4. {
  5. if (!(Email == null || Email == "" || Password == "" || Password == null))
  6. {
  7. IdentityUserModel UserModel = new IdentityUserModel();
  8. UserModel.Email = Email;
  9. UserModel.PasswordHash = Password;
  10. UserModel.UserName = Email;
  11. string userid=_authenticationService.CreateUser(UserModel);
  12. if (userid!=null)
  13. {
  14. //bool result=_authenticationService.AddToRoles(userid,[])
  15. **_authenticationService.CreateRole("مشتری");**
  16. }
  17. var MessageFile = messageclass.ShowMessage((int)MessageClass.MessageKind.objectsavefilerror);
  18. return Json(MessageFile, JsonRequestBehavior.AllowGet);
  19. }
  20. }
  21.  
  22. public bool CreateRole(string rolename)
  23. {
  24. var result=_roleManager.Create(new IdentityRole(rolename));
  25. return result.Succeeded;
  26. }
Add Comment
Please, Sign In to add comment