/// <summary> /// Convert a given Equipmentlocation to a ViewModel /// </summary> public static ViewModels.Equipmentlocation ToViewModel(this MicrosoftDynamicsCRMbcgovEquipmentlocation equipmentLocation) { ViewModels.Equipmentlocation result = null; if (equipmentLocation != null) { result = new ViewModels.Equipmentlocation() { Id = equipmentLocation.BcgovEquipmentlocationid, Name = equipmentLocation.BcgovName, SettingDescription = equipmentLocation.BcgovSettingdescription, FromWhen = equipmentLocation.BcgovFromwhen }; if (equipmentLocation.BcgovLocation != null) { result.Location = equipmentLocation.BcgovLocation.ToViewModel(); } if (equipmentLocation.BcgovEquipment != null) { result.Equipment = equipmentLocation.BcgovEquipment.ToViewModel(); } } return(result); }
public IActionResult GetEquipmentLocation(string id, string locaId) { ViewModels.Equipmentlocation result = null; if ((!string.IsNullOrEmpty(id) && Guid.TryParse(id, out Guid equipmentId)) && (!string.IsNullOrEmpty(locaId) && Guid.TryParse(locaId, out Guid locationId))) { // query the Dynamics system to get the Equipment Location record. //MicrosoftDynamicsCRMbcgovEquipment equipment = _dynamicsClient.GetEquipmentByIdWithChildren(equipmentId); MicrosoftDynamicsCRMbcgovEquipmentlocation equipmentlocation = _dynamicsClient.GetEquipmentLocationByBothIds(equipmentId, locationId); if (equipmentlocation != null) { result = equipmentlocation.ToViewModel(); } else { return(new NotFoundResult()); } }
public static void CopyValues(this MicrosoftDynamicsCRMbcgovEquipmentlocation to, ViewModels.Equipmentlocation from) { to.BcgovName = from.Name; to.BcgovFromwhen = from.FromWhen; to.BcgovSettingdescription = from.SettingDescription; }