コード例 #1
0
        public async Task <IActionResult> DeleteDepartment(int id)
        {
            var dept = await _db.Departments.FirstOrDefaultAsync(d => d.Id == id);

            if (dept == null)
            {
                return(NotFound());
            }
            else
            {
                _db.Remove(dept);

                await _db.SaveChangesAsync();

                return(Ok(dept));
            }
        }