public TransactionViewModel(Transaction transaction) { ID = transaction.ID; Type = (TranType)transaction.TypeID; Price = transaction.Price; Date = transaction.Date; var product = transaction.Product; if (product != null) { ProductID = product.ID; ModelName = product.Model.Name; CategoryName = product.Model.Category.Name; SerialNumber = product.SerialNumber; } if (transaction.Operator != null) { Salesman = new SalesmanViewModel(transaction.Operator.Salesman); } if (transaction.Contragent != null) { ContragentLastName = new ContragentViewModel(transaction.Contragent); } }
public CashTransactionViewModel(Transaction transaction) { ID = transaction.ID; Date = transaction.Date; CashTranType = (TranType) transaction.TypeID; Salesman = new SalesmanViewModel(transaction.Operator.Salesman); if (transaction.Contragent != null) Contragent = new ContragentViewModel(transaction.Contragent); if (transaction.Price != null) Price = transaction.Price.Value; Notes = transaction.Notes; }
public CashTransactionViewModel(Transaction transaction) { ID = transaction.ID; Date = transaction.Date; CashTranType = (TranType)transaction.TypeID; Salesman = new SalesmanViewModel(transaction.Operator.Salesman); if (transaction.Contragent != null) { Contragent = new ContragentViewModel(transaction.Contragent); } if (transaction.Price != null) { Price = transaction.Price.Value; } Notes = transaction.Notes; }
public TransactionViewModel(Transaction transaction) { ID = transaction.ID; Type = (TranType)transaction.TypeID; Price = transaction.Price; Date = transaction.Date; var product = transaction.Product; if (product != null) { ProductID = product.ID; ModelName = product.Model.Name; CategoryName = product.Model.Category.Name; SerialNumber = product.SerialNumber; } if (transaction.Operator != null) Salesman = new SalesmanViewModel(transaction.Operator.Salesman); if (transaction.Contragent != null) ContragentLastName = new ContragentViewModel(transaction.Contragent); }