Ejemplo n.º 1
0
        public async Task <IActionResult> PutWord(int id, Word word)
        {
            if (id != word.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Ejemplo n.º 2
0
 public bool DeleteEntity(T entity)
 {
     db.Entry(entity).State = System.Data.Entity.EntityState.Deleted;
     return(db.SaveChanges() > 0);
 }