public async Task <SimulateGoalVM> Handle(CreateRequest <SimulateGoalVM> request, CancellationToken cancellationToken) { SimulateGoalDocument document = request.Item.ToDocument(); document.Id = ObjectId.GenerateNewId().ToString(); await _client.SimulateGoalsCollection.CreateDocumentAsync(document); request.Item.Id = document.Id; return(request.Item); }
public static SimulateGoalDocument ToDocument(this SimulateGoalVM simulateGoalVM) { var document = new SimulateGoalDocument() { Id = simulateGoalVM.Id, AnnualPercente = simulateGoalVM.AnnualPercente, BeginValue = simulateGoalVM.BeginValue, DateKind = simulateGoalVM.DateKind, Contributions = simulateGoalVM.Contributions?.ToDocument() }; return(document); }