/// <summary> /// Un-Map student from driver /// </summary> /// <param name="newDriverHostMappingViewModel"></param> /// <returns></returns> public async Task <bool> UnMapDriverToHost(NewDriverHostMappingViewModel newDriverHostMappingViewModel) { // Save changes to driver return(await _driverLogic.Update(newDriverHostMappingViewModel.DriverId, x => { // Remove map x.Host = null; x.HostRefId = null; }) != null); }
/// <summary> /// Logic to handle the mapping /// </summary> /// <param name="newDriverHostMappingViewModel"></param> /// <returns></returns> public async Task <bool> MapDriverToHost(NewDriverHostMappingViewModel newDriverHostMappingViewModel) { var host = await _hostLogic.Get(newDriverHostMappingViewModel.HostId); // Save changes to driver return(_driverLogic.Update(newDriverHostMappingViewModel.DriverId, x => { // Add map x.Host = host; x.HostRefId = host.Id; }) != null); }
public async Task <IActionResult> DriverHostMappingUnMap([FromBody] NewDriverHostMappingViewModel newDriverHostMappingViewModel) { return(Ok(await _driverHostMappingLogic.UnMapDriverToHost(newDriverHostMappingViewModel))); }