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))))); } }
public IHttpActionResult Get(int id) { return(Ok(TheModelFactory.CreateUser(TheRepository.GetUserByUserId(id)))); }
public IHttpActionResult Get() { return(Ok(TheRepository.GetAllUsers().ToList().Select(x => TheModelFactory.CreateUser(x)).ToList())); }