Exemplo n.º 1
0
        // Create a new Session
        // POST /api/session
        public HttpResponseMessage Post(Session session)
        {
            Uow.Sessions.Add(session);
            Uow.Commit();

            var response = Request.CreateResponse(HttpStatusCode.Created, session);

            // Compose location header that tells how to get this session
            // e.g. ~/api/session/5
            response.Headers.Location =
                new Uri(Url.Link(WebApiConfig.ControllerAndId, new {id = session.Id}));

            return response;
        }
Exemplo n.º 2
0
 // Update an existing Session
 // PUT /api/sessions/
 public HttpResponseMessage Put(Session session)
 {
     Uow.Sessions.Update(session);
     Uow.Commit();
     return new HttpResponseMessage(HttpStatusCode.NoContent);
 }