Пример #1
0
        public async Task <IActionResult> PutDepartment(long id, DBDepartment department)
        {
            if (id != department.Iddepartment)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Пример #2
0
        public async Task <ActionResult <DBDepartment> > PostDepartment(DBDepartment department)
        {
            _context.Department.Add(department);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetDepartment", new { id = department.Iddepartment }, department));
        }
Пример #3
0
        //获取部门列表
        public InterfaceOutPut Query(string data)
        {
            InterfaceOutPut output = new InterfaceOutPut();
            DBDepartment    d      = new DBDepartment();

            output.resultStr = "获取数据成功!";
            output.data      = d.GetDepartmentList();
            return(output);
        }
 public override void Initialize()
 {
     base.Initialize();
     dbEntity = new DBDepartment(connManager);
 }