public async Task <IActionResult> PutGoogleRoadIcon([FromRoute] int id, [FromBody] GoogleRoadIcon googleRoadIcon) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != googleRoadIcon.Id) { return(BadRequest()); } _context.Entry(googleRoadIcon).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GoogleRoadIconExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostGoogleRoadIcon([FromBody] GoogleRoadIcon googleRoadIcon) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var icon = new GoogleRoadIcon() { GoogleRoadId = googleRoadIcon.GoogleRoadId, Descriptions = googleRoadIcon.Descriptions, Lat = googleRoadIcon.Lat, Lng = googleRoadIcon.Lng, Location = googleRoadIcon.Location, Url = googleRoadIcon.Url }; _context.GoogleRoadIcons.Add(icon); await _context.SaveChangesAsync(); return(CreatedAtAction("GetGoogleRoadIcon", new { id = icon.Id }, icon)); }