Пример #1
0
 public virtual void Delete(T entity)
 {
     if (RepositoryContext.Entry(entity).State == EntityState.Detached)
     {
         DWDbSet.Attach(entity);
     }
     DWDbSet.Remove(entity);
 }
Пример #2
0
        public async Task <IActionResult> PutStudent(string id, Student student)
        {
            if (id != student.EmployeeId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }