Cześć. Mam taki problem oto moj model domenowy OrderItem:
public class OrderItem
{
protected OrderItem()
{
}
public OrderItem(Guid productId, decimal price, string userId)
{
Id = Guid.NewGuid();
ProductId = productId;
Price = price;
CustomerId = HttpContext.Current.User.Identity.GetUserId();
Quantity = 1;
UserId = userId;
}
public Guid Id { get; protected set; }
public Guid OrderId { get; protected set; }
public Guid ProductId { get; protected set; }
public int Quantity { get; protected set; }
public decimal Price { get; protected set; }
public string UserId { get; protected set; }
public OrderStatus OrderStatus { get; protected set; }
public string CustomerId { get; protected set; }
public virtual Product Product { get; protected set; }
public virtual Order Order { get; protected set; }
public string ProductName()
{
return Product.Name;
}
public void inproveQuantity( Product product)
{
this.Quantity++;
if (this.Quantity > this.Quantity)
{
this.Quantity = product.Quantity;
}
}
}
public enum OrderStatus
{
Nowe, Zrealizowane
}
Nie wiem czemu ale jak chcę zwrócić Nazwę Produktu jest null. Dlaczego kurcze ? W innym modelach domenowych mi to działa