示例#1
0
        public async Task <IActionResult> GetSupervisorView(long supervisorId)
        {
            SupervisorModule invMod = new SupervisorModule();

            SupervisorView view = await invMod.Supervisor.Query().GetViewById(supervisorId);

            return(Ok(view));
        }
示例#2
0
        public async Task <IActionResult> DeleteSupervisor([FromBody] SupervisorView view)
        {
            SupervisorModule invMod     = new SupervisorModule();
            Supervisor       supervisor = await invMod.Supervisor.Query().MapToEntity(view);

            invMod.Supervisor.DeleteSupervisor(supervisor).Apply();

            return(Ok(view));
        }
示例#3
0
        public async Task <IActionResult> UpdateSupervisor([FromBody] SupervisorView view)
        {
            SupervisorModule invMod = new SupervisorModule();

            Supervisor supervisor = await invMod.Supervisor.Query().MapToEntity(view);


            invMod.Supervisor.UpdateSupervisor(supervisor).Apply();

            SupervisorView retView = await invMod.Supervisor.Query().GetViewById(supervisor.SupervisorId);


            return(Ok(retView));
        }
示例#4
0
        public async Task <IActionResult> AddSupervisor([FromBody] SupervisorView view)
        {
            SupervisorModule invMod = new SupervisorModule();

            NextNumber nnSupervisor = await invMod.Supervisor.Query().GetNextNumber();

            view.SupervisorNumber = nnSupervisor.NextNumberValue;

            Supervisor supervisor = await invMod.Supervisor.Query().MapToEntity(view);

            invMod.Supervisor.AddSupervisor(supervisor).Apply();

            SupervisorView newView = await invMod.Supervisor.Query().GetViewByNumber(view.SupervisorNumber);


            return(Ok(newView));
        }