public async Task <ActionResult <HiRailLocation> > PostHiRailLocation(HiRailLocation hiRailLocation) { _context.HiRailLocations.Add(hiRailLocation); await _context.SaveChangesAsync(); return(CreatedAtAction("GetHiRailLocation", new { id = hiRailLocation.Id }, hiRailLocation)); }
public async Task <IActionResult> PutHiRailLocation(Guid id, HiRailLocation hiRailLocation) { if (id != hiRailLocation.Id) { return(BadRequest()); } _context.Entry(hiRailLocation).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!HiRailLocationExists(id)) { return(NotFound()); } else { return(StatusCode(StatusCodes.Status500InternalServerError)); } } return(NoContent()); }