public async Task <ActionResult <MyLocationAPI> > PostMyLocationAPI(MyLocationAPI myLocationAPI) { _context.Locations.Add(myLocationAPI); await _context.SaveChangesAsync(); return(CreatedAtAction("GetMyLocationAPI", new { id = myLocationAPI.UserId }, myLocationAPI)); }
public async Task <IActionResult> PutMyLocationAPI(int id, MyLocationAPI myLocationAPI) { if (id != myLocationAPI.UserId) { return(BadRequest()); } _context.Entry(myLocationAPI).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MyLocationAPIExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }