BExIS.Dlm.Services.Party.PartyManager.AddPartyStatus C# (CSharp) Method

AddPartyStatus() public method

public AddPartyStatus ( Party party, PartyStatusType partyStatusType, string description ) : PartyStatus
party BExIS.Dlm.Entities.Party.Party
partyStatusType BExIS.Dlm.Entities.Party.PartyStatusType
description string
return PartyStatus
        public PartyStatus AddPartyStatus(PartyX party, PartyStatusType partyStatusType, string description)
        {
            Contract.Requires(party != null);
            Contract.Requires(partyStatusType != null);
            Contract.Ensures(Contract.Result<PartyStatus>() != null && Contract.Result<PartyStatus>().Id >= 0);
            var entity = new PartyStatus()
            {
                Description = description,
                Party = party,
                StatusType = partyStatusType,
                Timestamp = DateTime.Now
            };
            using (IUnitOfWork uow = this.GetUnitOfWork())
            {
                IRepository<PartyStatus> repoStatus = uow.GetRepository<PartyStatus>();

                repoStatus.Put(entity);
                // The current status must get updated, too. dependes on the current status's update logic.
                uow.Commit();
            }
            return (entity);
        }