public Task <Person> UpdateAsync(int id, PersonStatusEnum status) { Person person = null; using (var context = new EFCore_GraphQLDbContext()) { person = context.Persons.Include(p => p.PhoneNumbers) .SingleOrDefault(p => p.Id == id); person.Status = status; context.SaveChanges(); } //add event var personEvent = new PersonEvent() { Id = 2, Name = person.Name, Status = person.Status, Timestamp = DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss") }; _eventsService.AddEvent(personEvent); return(Task.FromResult(person)); }
public static Person ToEntity(this PersonModel @this, PersonStatusEnum status) { return(new Person { Ssn = @this.Ssn, FirstName = @this.FirstName, LastName = @this.LastName, Status = status, }); }
private IObservable <PersonEvent> Subscribe(ResolveEventStreamContext arg) { var statusList = arg.GetArgument <IList <PersonStatusEnum> >( "statuses", new List <PersonStatusEnum>() ); if (statusList.Count > 0) { PersonStatusEnum statuses = 0; foreach (var status in statusList) { statuses = statuses | status; } return(_personEventService.EventStream() .Where(e => (e.Status & statuses) == e.Status)); } else { return(_personEventService.EventStream()); } }
public void SetPersonStatus(Guid personId, PersonStatusEnum status) { }