public IHttpActionResult PostUserAccount(UserAccount userAccount) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.CreateUserAccount(userAccount); return(CreatedAtRoute("DefaultApi", new { id = userAccount.UserAccountID }, userAccount)); }
public IHttpActionResult PostUserAccount(string UserName, string Password) { if (UserName == null || Password == null) { return(StatusCode(HttpStatusCode.BadRequest)); } UserAccount userAccount = new UserAccount(); userAccount.UserName = UserName; userAccount.IsActive = false; userAccount.IsDeleted = false; userAccount.Password = Encoding.ASCII.GetBytes(Password); if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _user.CreateUserAccount(userAccount); return(CreatedAtRoute("DefaultApi", new { id = userAccount.UserAccountID }, userAccount)); }