public void Save(WeighScaleViewModel vm) { WeighScale weighScale = new WeighScale(vm.Id); weighScale.Name = vm.Name; weighScale.Code = vm.Code; weighScale.EquipmentNumber = vm.EquipmentNumber; weighScale.Make = vm.Make; weighScale.Model = vm.Model; weighScale.EquipmentType = (EquipmentType)vm.EquipmentType; weighScale.Description = vm.Description; weighScale.CostCentre = (Hub)_hubRepository.GetById(vm.CostCentre); weighScale._Status = EntityStatus.Active; _equipmentRepository.Save(weighScale); }
WeighScaleViewModel Map(WeighScale equipment) { WeighScaleViewModel vm = new WeighScaleViewModel(); vm.Id = equipment.Id; vm.Code = equipment.Code; vm.EquipmentNumber = equipment.EquipmentNumber; vm.Name = equipment.Name; vm.Make = equipment.Make; vm.Model = equipment.Model; vm.EquipmentType = (int)equipment.EquipmentType; vm.Description = equipment.Description; vm.CostCentre = equipment.CostCentre.Id; vm.IsActive = (int)equipment._Status; vm.CostCentreName = equipment.CostCentre.Name; return vm; }
private VMWeighingScaleItem Map(WeighScale weighingScale, int index, XElement xlmEquipConfig) { var mapped = new VMWeighingScaleItem { WeighingScale = weighingScale, RowNumber = index+1 }; if (weighingScale._Status == EntityStatus.Active) mapped.HlkDeactivateContent = "Deactivate"; if (weighingScale._Status == EntityStatus.Inactive) mapped.HlkDeactivateContent = "Activate"; if (xlmEquipConfig != null) mapped = MapConfig(mapped, xlmEquipConfig); return mapped; }
public WeighScaleDTO Map(WeighScale scale) { if (scale == null) return null; var scaleDto = Mapper.Map<WeighScale, WeighScaleDTO>(scale); return scaleDto; }
protected Guid AddWeighingScale(string equipmentNo, string code, string name, string make, string model, string desc, Guid hubId) { WeighScale scale = new WeighScale(Guid.NewGuid()) { EquipmentNumber = equipmentNo, Code = code, Name = name, Make = make, Model = model, EquipmentType = EquipmentType.WeighingScale, Description = desc, CostCentre = _costCentreRepository.GetById(hubId) as Hub }; return _equipmentRepository.Save(scale); }