public HttpResponseMessage Get(string type, string code = "") { switch (type.ToLower()) { case "hotels": List <Hotel> hotels = _repo.FetchHotels().Select(h => new Hotel(h)).ToList(); return(Request.CreateResponse(HttpStatusCode.OK, hotels)); //case "guests": // List<WeddingGuest> guests = _repo.FetchGuests().Select(g => new WeddingGuest(g)).ToList(); // return Request.CreateResponse(HttpStatusCode.OK, guests); //case "groups": // List<WeddingGuestGroup> groups = _repo.FetchGroups().Select(g => new WeddingGuestGroup(g)).ToList(); // return Request.CreateResponse(HttpStatusCode.OK, groups); //case "food": // List<FoodChoice> food2 = _repo.FetchFoodChoices().Select(f => new FoodChoice(f)).ToList(); // return Request.CreateResponse(HttpStatusCode.OK, food2.ToDictionary(k => k.GuestId)); case "login": IWeddingGuestGroup igroup; List <WeddingGuest> guests2 = _repo.FetchGuests(code, out igroup).Select(g => new WeddingGuest(g)).ToList(); List <FoodChoice> food = _repo.FetchFoodChoicesForGuests(guests2).Select(f => new FoodChoice(f)).ToList(); WeddingGuestGroup group = null; if (igroup != null) { group = new WeddingGuestGroup(igroup); } return(Request.CreateResponse(HttpStatusCode.OK, new { granted = guests2.Count() > 0, guests = guests2, group = group, food = food })); } return(Request.CreateResponse(HttpStatusCode.NoContent)); }