Esempio n. 1
0
        public async Task <ActionResult> MoveDepartment(List <Guid> id)
        {
            var businessUnits = await Mediator.Send(new GetBusinessUnitListQuery());

            ViewBag.BusinessUnits = businessUnits.BusinessUnits;

            if (id.Count != 1)
            {
                return(PartialView("_MoveDepartment", new MoveDepartmentCommand {
                    DepartmentIds = id
                }));
            }

            var department = await Mediator.Send(new GetDepartmentDetailQuery()
            {
                Id = id.First()
            });

            if (department == null)
            {
                return(BadRequest());
            }

            var command = new MoveDepartmentCommand
            {
                DepartmentIds = new List <Guid> {
                    department.Id
                },
                BusinessUnitId = department.BusinessUnitId
            };

            return(PartialView("_MoveDepartment", command));
        }
Esempio n. 2
0
        public async Task <ActionResult> MoveDepartment(MoveDepartmentCommand command)
        {
            if (await Mediator.Send(command) == null)
            {
                return(BadRequest());
            }

            return(new JsonResult("Success"));
        }