/// <summary> /// Un-Map student from driver /// </summary> /// <param name="newStudentDriverMappingViewModel"></param> /// <returns></returns> public async Task <bool> UnMapStudentToDriver(NewStudentDriverMappingViewModel newStudentDriverMappingViewModel) { // Save changes to driver return(await _studentLogic.Update(newStudentDriverMappingViewModel.StudentId, x => { // Remove map x.Driver = null; x.DriverRefId = null; }) != null); }
/// <summary> /// Logic to handle the mapping /// </summary> /// <param name="newStudentDriverMappingViewModel"></param> /// <returns></returns> public async Task <bool> MapStudentToDriver(NewStudentDriverMappingViewModel newStudentDriverMappingViewModel) { var driver = await _driverLogic.Get(newStudentDriverMappingViewModel.DriverId); // Save changes to driver return(await _studentLogic.Update(newStudentDriverMappingViewModel.StudentId, x => { // Add map x.Driver = driver; x.DriverRefId = driver.Id; }) != null); }
public async Task <IActionResult> StudentDriverMappingUnMap([FromBody] NewStudentDriverMappingViewModel newStudentDriverMappingViewModel) { return(Ok(await _studentDriverMappingLogic.UnMapStudentToDriver(newStudentDriverMappingViewModel))); }