Let's assume that I have a class Offer
which is:
public class Offer
{
[Key]
public int ID { get; set; }
//...
public virtual List<OfferEventManager> EventManagers { get; set; }
public virtual List<EventDay> EventDays { get; set; }
public virtual List<OfferStatus> OfferStatuses { get; set; }
public virtual List<EstimatedCost> EstimatedCosts { get; set; }
public virtual List<Payment> Payments { get; set; }
}
And I'll have to do some checking, e.g. Someone wants to send an Offer
to client, but first Offer
has to be in speciffic OfferStatus
, some example EventDays
and example EstimatedCost
. Now let's assume that I'll have to check it not only in one function, but in some more, so I'll need to know what is the latest OfferStatus
etc. Should I store a function inside Model e.g. GetLatestStatus()
and some other functions or Model should have only properties which are stored in DB? If I can't store functions inside then what is the best way to write some usefull functions which I can use with Offer
got from DB call?