public async Task <HookResult> Execute(UserCreateEvent domainEvent) { var userWithPostNumberQuery = UserWithPostNumberQuery.Create(domainEvent); await _queryRepo.Create(userWithPostNumberQuery); return(await Task.FromResult(HookResult.OkResult())); }
public async Task Run() { var events = await HangfireQueue.GetEvents("OnUserCreateCreateQuery"); var handledEvents = new List <EventAndJob>(); var enumerator = events.GetEnumerator(); for ( ; enumerator.MoveNext(); ) { var eventWrapper = enumerator.Current; var domainEvent = (UserCreateEvent)eventWrapper.DomainEvent; var entity = await UserRepository.GetUser(domainEvent.Id); var newCreateEvent = new UserCreateEvent(entity, domainEvent.EntityId); var hookResult = await AsyncHook.Execute(newCreateEvent); if (hookResult.Ok) { handledEvents.Add(eventWrapper); } } await HangfireQueue.RemoveEventsFromQueue(handledEvents); }
public async Task <HookResult> Execute(UserCreateEvent domainEvent) { // TODO: Implement this method; return(await Task.FromResult(HookResult.ErrorResult(new List <string> { "A generated Synchronouse Doman Hook Method that is not implemented was called, aborting..." }))); }
public static UserWithPostNumberQuery Create(UserCreateEvent domainEvent) { return(new UserWithPostNumberQuery { Id = Guid.NewGuid(), RootEntityId = domainEvent.EntityId, Name = domainEvent.User.Name, PostNumber = 0, LatestTitleChange = "No changes yet" }); }
public async Task <HookResult> Execute(UserCreateEvent domainEvent) { if (domainEvent.User.Age > 100) { return(HookResult.ErrorResult(new List <string> { "User must not be older than 100" })); } var newUserAge = domainEvent.User.Age + 10; var domainEventBases = new List <DomainEventBase>(); domainEventBases.Add(new UserUpdateAgeEvent(newUserAge, Guid.NewGuid())); return(await Task.FromResult(HookResult.OkResult())); }
public void HandleEvent(UserCreateEvent e) { this.AggregateRootId = e.AggregateRootId; this.UserName = e.UserName; this.Password = e.Password; this.DisplayName = e.DisplayName; this.Email = e.Email; this.ContactPhone = e.ContactPhone; this.Address_Country = e.Address_Country; this.Address_State = e.Address_State; this.Address_City = e.Address_City; this.Address_Street = e.Address_Street; this.Address_Zip = e.Address_Zip; }
private void HandleEvent(UserCreateEvent domainEvent) { using (QueryDBEntities _dbContext = new QueryDBEntities()) { User user = new User { AggregateRootId = domainEvent.AggregateRootId, UserName = domainEvent.UserName, Password = domainEvent.Password, DisplayName = domainEvent.DisplayName, Email = domainEvent.Email, ContactPhone = domainEvent.ContactPhone, Address_Country = domainEvent.Address_Country, Address_State = domainEvent.Address_State, Address_Street = domainEvent.Address_Street, Address_City = domainEvent.Address_City, Address_Zip = domainEvent.Address_Zip }; _dbContext.User.Add(user); _dbContext.SaveChanges(); } }
// Event Action Results public IActionResult CreateEvent(UserCreateEvent createEvent) { GetCategoriesHelper(); bool bRet = true; /*if((createEvent.guest == true && createEvent.guestEmail == null && createEvent.guestUsername == null) || * (createEvent.guest == false && createEvent.guestEmail != null && createEvent.guestUsername != null) || (createEvent.guest == false && createEvent.guestEmail != null && createEvent.guestUsername == null || createEvent.category == null) || createEvent.eventName == null) * { * bRet = false; * }*/ if (createEvent.eventName == null || createEvent.event_date == null || createEvent.start_at == null || createEvent.end_at == null || createEvent.category == null) { bRet = false; } int userid = (int)TempData["userid"]; ViewData["friendobjects"] = _manager.GetFriends(userid); // True, save event to the database if (bRet) { bRet = _manager.SaveEvent(createEvent, userid); if (bRet) { ViewBag.message = "Event saved successfully!"; } } else { ViewBag.message = "Event was not saved, all fields were not filled in!"; } TempData["userid"] = userid; TempData["ProfilePicFromDB"] = TempData["ProfilePicFromDB"] as string; TempData.Keep("ProfilePicFromDB"); return(View("Weekly")); }
public async Task <HookResult> Execute(UserCreateEvent domainEvent) { // TODO: Implement this method; Console.WriteLine("ERROR: The generated Async Domain Hook Method OnUserCreateSendPasswordMailAsyncHook that is not implemented was called, aborting..."); return(await Task.FromResult(HookResult.ErrorResult(new List <string>()))); }