コード例 #1
0
 public IHttpActionResult GetStations([FromBody] IEnumerable <string> ids)
 {
     if (ids.Count() > 0)
     {
         return(Ok(_stationRepo.GetMultipleStations(ids)));
     }
     else
     {
         return(BadRequest("Must provide one or more station ids"));
     }
 }
コード例 #2
0
        public IHttpActionResult CreateGroup([FromBody] RegisterGroup newGroup)
        {
            Group group = new Group();

            group.Owner_Id    = RequestContext.Principal.Identity.GetUserId();
            group.Name        = newGroup.Name;
            group.Description = newGroup.Description;
            IEnumerable <Station> stations = _stationsRepo.GetMultipleStations(newGroup.StationIds);

            group.Stations = new Collection <Station>(stations.ToList());
            group          = _repo.CreateGroup(group);
            return(Ok(group));
        }