Esempio n. 1
0
        public async Task <IActionResult> PutValue(int id, Value value)
        {
            if (id != value.ID)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async System.Threading.Tasks.Task <T> Update(T entity)
        {
            _ctx.Entry(entity).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
            await _ctx.SaveChangesAsync();

            return(entity);
        }
Esempio n. 3
0
 public async void UpdateAsync(TEntity entity)
 {
     _context.Entry(entity).State = EntityState.Modified;
     await _context.SaveChangesAsync();
 }