public async Task TestGetSupervisorBySupervisorId() { int supervisorId = 1; AddressBookModule abMod = new AddressBookModule(); SupervisorView view = await abMod.Supervisor.Query().GetViewById(supervisorId); Assert.Equal(view.ParentSupervisorName.ToUpper().ToString(), "PAM NISHIMOTO".ToString()); }
public async Task <IActionResult> GetSupervisorView(long supervisorId) { SupervisorModule invMod = new SupervisorModule(); SupervisorView view = await invMod.Supervisor.Query().GetViewById(supervisorId); return(Ok(view)); }
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)); }
/// <summary> /// Opens the supervisor screen in a new window so /// the manager can see the current information in the database /// </summary> private void openSupervisorView() { MainWindow secondWindow = new MainWindow(); Page sup = new SupervisorView(); secondWindow.Show(); secondWindow.Content = sup; secondWindow.MinHeight = 700; secondWindow.MinWidth = 1400; }
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)); }
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)); }