示例#1
0
        public async Task <IActionResult> PutChargingPointLocation(int id, ChargingPointLocation chargingPointLocation)
        {
            if (id != chargingPointLocation.Id)
            {
                return(BadRequest());
            }

            _context.Entry(chargingPointLocation).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ChargingPointLocationExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
示例#2
0
        public async Task <ActionResult <ChargingPointLocation> > PostChargingPointLocation(ChargingPointLocation chargingPointLocation)
        {
            _context.ChargingPointLocations.Add(chargingPointLocation);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetChargingPointLocation", new { id = chargingPointLocation.Id }, chargingPointLocation));
        }