public HttpResponseMessage GetUserForMyAccount() { TransactionalInformation transaction = new TransactionalInformation(); UsersApiModel usersM = new UsersApiModel(); User user = settingsDataService.GetUserForMyAccount(connectionString, SessionToken, out transaction); usersM.user = user; if (transaction.ReturnStatus) { return(Request.CreateResponse(HttpStatusCode.OK, usersM)); } return(Request.CreateResponse <TransactionalInformation>(HttpStatusCode.BadRequest, transaction)); }
public HttpResponseMessage getUsers() { TransactionalInformation transaction = new TransactionalInformation(); UsersApiModel usersM = new UsersApiModel(); List <Employee_Model> users = settingsDataService.GetUsers(connectionString, SessionToken, out transaction); usersM.users = users; if (transaction.ReturnStatus) { return(Request.CreateResponse(HttpStatusCode.OK, usersM)); } return(Request.CreateResponse <TransactionalInformation>(HttpStatusCode.BadRequest, transaction)); }
// PUT: api/AccountApi/5 public IHttpActionResult Put(int id, [FromBody] UsersApiModel rvm) { User user = us.GetById(id); if (user == null) { return(NotFound()); } else { user.PhoneNumber = rvm.PhoneNumber; user.firstname = rvm.firstname; user.Email = rvm.Email; user.UserName = rvm.Email; user.lastname = rvm.lastname; user.PasswordHash = rvm.Password; us.Update(user); us.Commit(); return(Ok(user)); } }