Beispiel #1
0
        public HttpResponseMessage PostGuest(List <WeddingGuest> guests)
        {
            List <WeddingGuest> result = new List <WeddingGuest>();

            guests.ForEach((guest) =>
            {
                if (guest.GuestId < 0)
                {
                    result.Add(new WeddingGuest(_repo.AddGuest(guest)));
                }
                else
                {
                    result.Add(new WeddingGuest(_repo.SaveGuest(guest)));
                }
            });

            if (result != null)
            {
                return(Request.CreateResponse(HttpStatusCode.OK, result));
            }
            return(Request.CreateResponse(HttpStatusCode.NoContent));
        }