Beispiel #1
0
 public bool Register(RegisterInfo registerInfo)
 {
     if (registerInfo.Role == "student")
     {
         _usersProvider.Create(new Student(registerInfo.Name, registerInfo.LastName));
         _loginInfoesProvider.Create(new LoginInfo(registerInfo.Name, registerInfo.LastName, registerInfo.Password));
         return(true);
     }
     return(false);
 }
Beispiel #2
0
        public void UserIndependent()
        {
            IUsersProvider provider = Provider.UsersProvider;

            provider.Clear().Wait();
            Assert.IsFalse(provider.GetAll().Result.Any());
            foreach (var v in usernames)
            {
                Assert.AreEqual(v, provider.Create(v, new User()).Result);
                Assert.IsNotNull(provider.Get(v).Result);
                Assert.AreEqual(v, provider.Update(v, new User()).Result);
                Assert.AreEqual(v, provider.Delete(v).Result);
                Assert.IsNull(provider.Get(v).Result);
            }
        }
Beispiel #3
0
        public async Task <HttpResponseMessage> Create(UsersCreateRequest request)
        {
            if (request == null)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, "please enter valid input"));
            }
            User user = _usersProvider.Create(request);

            if (user.Id == 0)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, "The provided email is already being used."));
            }
            var resp = await _sendGridProvider.SendVerification(user);

            return(req.CreateResponse(HttpStatusCode.OK, resp));
        }
 public async Task <string> Create(string id, [FromBody] User data)
 {
     return(await provider.Create(id, data));
 }