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

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

            // Compose location header that tells how to get this attendance
            // e.g. ~/api/attendance/?pid=2&sid=1
            var queryString = string.Format(
                "?pid={0}&sid={1}", attendance.PersonId, attendance.SessionId);
            response.Headers.Location =
                new Uri(Url.Link(WebApiConfig.ControllerOnly, null) + queryString);

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