public ActionResult Retry(Guid id) { BookSagaEvent sagaEvent = bookSagaEventRepository.Get(id); var eventData = modelConverter.Convert(sagaEvent); mediatr.Publish(eventData); return(Ok()); }
public INotification Convert(BookSagaEvent sagaEvent) { var type = AppDomain.CurrentDomain.GetAssemblies() .SelectMany(x => x.GetTypes()) .FirstOrDefault(x => x.FullName == sagaEvent.EventDataType); var req = JsonConvert.DeserializeObject(sagaEvent.EventData, type); JObject jObject = JObject.Parse(sagaEvent.EventData); var book = jObject.GetValue("Book"); var bookDto = book.ToObject <BookDto>(); SetValue(req, "Book", bookDto); return(req as INotification); }
public BookSagaEvent Add(BookSagaEvent book) { dbContext.Add(book); dbContext.SaveChanges(); return(book); }