Beispiel #1
0
        public HttpResponseMessage Put([FromBody]NewUser newUser)
        {
            var user = new User(newUser);

            Db.Users.Add(user);

            var session = new Session(user);

            Db.Sessions.Add(session);

            Db.SaveChanges();

            var response = Request.CreateResponse(HttpStatusCode.OK, new NewSession(session));
            response.Headers.Location = new Uri(Request.RequestUri + "/" + user.Id);

            return response;
        }
Beispiel #2
0
 public NewSession(Session session)
 {
     Id = session.Id;
 }