예제 #1
0
        public IHttpActionResult Post([FromBody] UserUriModel model)
        {
            if (TheRepository.GetUserByUserName(model.UserName) != null)
            {
                return(Conflict());
            }
            if (TheRepository.InsertUser(TheModelFactory.ParseUser(model)) && TheRepository.SaveAll())
            {
                return(Created(TheModelFactory.CreateUser(TheModelFactory.ParseUser(model)).Url, model));
            }

            return(BadRequest());
        }
        public IHttpActionResult Get(int userId)
        {
            string name      = _identityService.CurrentUser;
            var    userModel = TheModelFactory.CreateUser(TheRepository.GetUserByUserId(userId));

            if (userModel.UserName != name)
            {
                return(Unauthorized());
            }
            else
            {
                return(Ok((TheRepository.GetCertificationForUser(userId).Select(cu => TheModelFactory.GetCertificateInfo(cu)))));
            }
        }
예제 #3
0
 public IHttpActionResult Get(int id)
 {
     return(Ok(TheModelFactory.CreateUser(TheRepository.GetUserByUserId(id))));
 }
예제 #4
0
 public IHttpActionResult Get()
 {
     return(Ok(TheRepository.GetAllUsers().ToList().Select(x => TheModelFactory.CreateUser(x)).ToList()));
 }