示例#1
0
        public IActionResult PutDepartment(int id, DepartmentUpdate model)
        {
            var choose = _context.Department.Find(id);

            _procedure.Department_Update(id, model.Name, model.Budget, model.StartDate, model.InstructorId, choose.RowVersion).Wait();
            return(NoContent());
        }
        public async Task <IActionResult> PutDepartment(int id, Department department)
        {
            if (id != department.DepartmentId)
            {
                return(BadRequest());
            }



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

            try
            {
                var test = _context.Department.Find(id);
                await sp.Department_Update(id, department.Name, department.Budget, test.StartDate, test.InstructorId, test.RowVersion, null);

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

            return(NoContent());
        }
        public override ActionResult PutEntity(int id, UpdateDepartmentModel model)
        {
            var updateEntity = _db.Department.Find(id);

            OutputParameter <int> returnValue = new OutputParameter <int>();

            _procedures.Department_Update(id, model.Name, model.Budget, model.StartDate, model.InstructorId, updateEntity.RowVersion, returnValue).GetAwaiter().GetResult();

            return(NoContent());
        }
        public async Task <IActionResult> PutDepartment(int id, Department model)
        {
            var record = db.Department.Find(id);

            if (record == null)
            {
                return(NotFound());
            }
            await spdb.Department_Update(model.DepartmentId, model.Name, model.Budget, model.StartDate, model.InstructorId, model.RowVersion);

            // record.Name = model.Name;
            // record.Budget = model.Budget;
            // record.StartDate = model.StartDate;
            // record.InstructorId = model.InstructorId;
            // record.RowVersion = model.RowVersion;
            // db.SaveChanges();
            return(Ok());
        }
示例#5
0
        public async Task <ActionResult <Department> > PutDepartment(int id, Department model)
        {
            await sp.Department_Update(id, model.Name, model.Budget, model.StartDate, model.InstructorId, model.RowVersion);

            return(NoContent());
        }