public ActionResult AddUserAccount(string rollNo) { CreateUserAccount user = new CreateUserAccount(); user.userID = rollNo; return(View(user)); }
/// <summary> /// Provides the Create request for the 'UserAccounts' resource. /// </summary> public CreateUserAccountResponse Post(CreateUserAccount body) { return(ProcessRequest(body, HttpStatusCode.Created, () => { var response = this.UserAccountsManager.CreateUserAccount(this.Request, body); this.SetLocationHeader(GetCreateUserAccountResponseId(response)); return response; })); }
public async Task <IActionResult> Create([FromBody] CreateUserAccount command) { var id = User.Claims.FirstOrDefault(c => c.Type == CustomClaims.BusinessIdClaim); if (id == null) { return(Unauthorized()); } await _userService.CreateUser(command.Email, Guid.Parse(id.Value)); return(Ok()); }
public ActionResult InsertUserAccount(CreateUserAccount student, HttpPostedFileBase upload) { Userinfo user = new Userinfo(); if (db.Userinfoes.Find(student.username) != null) { ViewBag.userMsg = "Username already exist."; return(View(student)); } else if (student.password == null) { ViewBag.pswMsg = "Password can not be null"; return(View(student)); } else if (student.password != student.confirmPassword) { ViewBag.pswMsg = "Password are not same"; return(View(student)); } user.username = student.username; user.passwordHash = Cryptography.getMD5(student.password); user.token = Cryptography.getMD5(student.username) + Cryptography.getMD5(student.password); user.role = "student"; user.email = student.email; if (upload != null && upload.ContentLength > 0) { string path = Path.Combine(Server.MapPath("~/Images"), Path.GetFileName(student.userID + ".jpg")); upload.SaveAs(path); user.imagePath = "~/Images/" + student.userID + ".jpg"; } db.Userinfoes.Add(user); string un = user.username; Student std = db.Students.Find(student.userID); try { std.username = un; } catch (Exception) { } db.Set <Student>().AddOrUpdate(std); db.SaveChanges(); return(RedirectToAction("index")); }
public void Initialize() { validator = new CreateUserAccountValidator(); dto = new CreateUserAccount { Address = new Address { Street1 = "astreet1", Street2 = "astreet2", Town = "atown", }, Email = "*****@*****.**", Forenames = "forenames", Surname = "asurname", MobilePhone = "+123-045-67 89 10", Username = "******", PasswordHash = PasswordHasher.CreateHash("apasswordhash"), }; }
CreateUserAccountResponse IUserAccountsManager.CreateUserAccount(IRequest request, CreateUserAccount body) { return(new CreateUserAccountResponse { UserAccount = (UserAccount) CreateUserAccount(request.GetCurrentUser(), body.Username, body.PasswordHash, body.Forenames, body.Surname, body.Email, body.MobilePhone, body.Address, null), }); }