public async Task <ActionResult <GeoMessageV2> > PostGeoMessages(V1GetDTO geoMessages) { var V2Model = new GeoMessageV2 { Message = new Message { Body = geoMessages.Message }, Longitude = geoMessages.Longitude, Latitude = geoMessages.Latitude }; _context.GeoMessageV2.Add(V2Model); await _context.SaveChangesAsync(); return(CreatedAtAction("GetGeoMessages", new { id = V2Model.ID }, V2Model)); }
public async Task <ActionResult <V1GetDTO> > GetGeoMessages(int id) { var geoMessages = await _context.GeoMessageV2.Include(c => c.Message).FirstOrDefaultAsync(a => a.ID == id); var V1Model = new V1GetDTO { Message = geoMessages.Message.Body, Longitude = geoMessages.Longitude, Latitude = geoMessages.Latitude }; if (geoMessages == null) { return(NotFound()); } return(V1Model); }