public SalesAccount(SalesAccountCreateActivity createActivity) { this.Id = createActivity.AccountId; this.Name = createActivity.Name; this.ClosedOn = createActivity.ClosedOn; this.Activities.Add(createActivity); }
public SalesAccountActivityResource Visit(SalesAccountCreateActivity activity) { return(new SalesAccountCreateActivityResource { AccountId = activity.AccountId, ActivityType = activity.GetType().Name, ChangedOn = DateTime.SpecifyKind(activity.ChangedOn, DateTimeKind.Utc).ToString("o"), ClosedOn = activity.ClosedOn.HasValue ? DateTime.SpecifyKind(activity.ClosedOn.Value, DateTimeKind.Utc).ToString("o") : null, Name = activity.Name, UpdatedByUri = activity.UpdatedByUri }); }
public IResult <SalesAccount> AddSalesAccount(SalesAccountCreateResource createResource, string updatedByUri) { var createActivity = new SalesAccountCreateActivity( updatedByUri, createResource.AccountId, createResource.Name, string.IsNullOrEmpty(createResource.ClosedOn) ? (DateTime?)null : DateTime.Parse(createResource.ClosedOn)); var account = new SalesAccount(createActivity); this.salesAccountRepository.Add(account); this.transactionManager.Commit(); return(new CreatedResult <SalesAccount>(account)); }
public void SetUp() { this.createActivity = new SalesAccountCreateActivity("/employees/100", 1, "New Account", 1.December(2018)); this.result = new SalesAccount(this.createActivity); }