コード例 #1
0
        public async Task <ActionResult <VentureLocation> > PostVentureLocation(VentureLocation ventureLocation)
        {
            _dbContext.VentureLocation.Add(ventureLocation);
            await _dbContext.SaveChangesAsync();

            return(CreatedAtAction("GetVentureLocation", new { key = ventureLocation.VentureLocationKey }, ventureLocation));
        }
コード例 #2
0
        public async Task <IActionResult> PutVentureLocation(Guid key, VentureLocation ventureLocation)
        {
            if (key != ventureLocation.VentureLocationKey)
            {
                return(BadRequest());
            }

            _dbContext.Entry(ventureLocation).State = EntityState.Modified;

            try
            {
                await _dbContext.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!VentureLocationExists(key))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }