Esempio n. 1
0
        public async Task <IActionResult> PostDepartment(PostDepartmentVM input)
        {
            // TODO: 如何接sp回傳值
            await _spContext.Department_Insert(input.Name, input.Budget, input.StartDate, input.InstructorId);

            return(NoContent());
        }
        public override ActionResult <Department> PostEntity(CreateDepartmentModel model)
        {
            OutputParameter <int> returnValue = new OutputParameter <int>();
            var output = _procedures.Department_Insert(model.Name, model.Budget, model.StartDate, model.InstructorId, returnValue).GetAwaiter().GetResult();

            return(Created($"api/Department/{output.FirstOrDefault()?.DepartmentID}", output));
        }
        public async Task <ActionResult <Department> > PostDepartmentAsync(Department model)
        {
            await spdb.Department_Insert(model.Name, model.Budget, model.StartDate, model.InstructorId);

            // db.Department.Add(model);
            // db.SaveChanges();
            return(Created($"api/Department/{model.DepartmentId}", model));
        }
        public async Task <ActionResult <Department> > PostDepartment(Department department)
        {
            await sp.Department_Insert(department.Name, department.Budget, department.StartDate, department.InstructorId, null);

            //_context.Department.Add(department);
            //await _context.SaveChangesAsync();

            return(CreatedAtAction("GetDepartment", new { id = department.DepartmentId }, department));
        }
Esempio n. 5
0
 public ActionResult <Department> PostDepartment(Department model)
 {
     _procedure.Department_Insert(model.Name, model.Budget, model.StartDate, model.InstructorId).Wait();
     return(null);
 }
Esempio n. 6
0
        public async Task <ActionResult <Department> > PostDepartmentSP(Department model)
        {
            await sp.Department_Insert(model.Name, model.Budget, model.StartDate, model.InstructorId);

            return(Created("/api/Department/" + model.DepartmentId, model));
        }