/// <summary> /// Gets an <see cref="AssetHistoryModel"/> for a given <paramref name="customerId"/> and <paramref name="cashboxId"/>. /// </summary> /// <param name="customerId">The customer id</param> /// <param name="cashboxId">The cashbox id</param> /// <returns>An instance of an <see cref="AssetHistoryModel"/></returns> public AssetHistoryModel GetHistoricListViewModel(int customerId, int cashboxId) { var cashbox = PemsEntities.CashBoxes.FirstOrDefault(m => m.CustomerID == customerId && m.CashBoxSeq == cashboxId); var model = new AssetHistoryModel() { CustomerId = customerId, AssetId = cashboxId, Type = cashbox == null ? CashboxViewModel.DefaultType : cashbox.MeterGroup == null ? CashboxViewModel.DefaultType : cashbox.MeterGroup.MeterGroupDesc ?? CashboxViewModel.DefaultType, TypeId = cashbox == null ? (int)MeterGroups.Cashbox : cashbox.CashBoxType ?? (int)MeterGroups.Cashbox, Name = cashbox == null ? "" : cashbox.CashBoxName ?? "", Street = "-" }; return(model); }
// these methods will have to be updated to pull back the correct data public AssetHistoryModel GetHistoricListViewModel(int customerId, int dataKeyId) { var model = new AssetHistoryModel { CustomerId = customerId, AssetId = dataKeyId, TypeId = (int)MeterGroups.Datakey, Street = "-" }; var type = PemsEntities.MeterGroups.FirstOrDefault(x => x.MeterGroupId == dataKeyId); model.Type = type == null ? DataKeyViewModel.DefaultType : type.MeterGroupDesc ?? DataKeyViewModel.DefaultType; return(model); }