// POST api/<controller> public HttpResponseMessage Post(MapViewModel mapVm) { Map map = ModelConverter.ToDbMapModel(mapVm); // If the ID is not zero, then edit the map if (map.Id > 0) { mapRepository.UpdateMap(map); } else // If the map has a zero id, then create a new map { map = mapRepository.CreateMap(map); } if (mapVm.SessionId > 0) { mapRepository.AddMapToSession(map.Id, mapVm.SessionId); } mapVm = ModelConverter.ToMapViewModel(mapRepository.GetMap(map.Id)); return(Request.CreateResponse(HttpStatusCode.OK, mapVm)); }
public HttpResponseMessage Post(int mapId, int sessionId) { mapRepository.AddMapToSession(mapId, sessionId); return(Request.CreateResponse(HttpStatusCode.OK)); }