public async Task <GoalCost> GetMostCostlyForPeriod(DateTime from, DateTime to) { var entity = await GoalCosts.Where(o => o.CompleteDateTime.Between(from, to)) .OrderByDescending(o => o.Cost) .FirstOrDefaultAsync(); return(entity?.ToDomain()); }
public async Task Create(GoalCost goalCost) { await GoalCosts.InsertAsync(() => new GoalCostEntity { Id = goalCost.Id, Title = goalCost.Title, Cost = goalCost.Cost, CompleteDateTime = goalCost.CompletedDateTime }); }
public async Task SetCost(string goalId, decimal cost) { await GoalCosts.Where(o => o.Id == goalId) .Set(o => o.Cost, cost) .UpdateAsync(); }
public async Task Update(string goalId, string title) { await GoalCosts.Where(o => o.Id == goalId) .Set(o => o.Title, title) .UpdateAsync(); }
public async Task Complete(string goalId, DateTime completeDateTime) { await GoalCosts.Where(o => o.Id == goalId) .Set(o => o.CompleteDateTime, completeDateTime) .UpdateAsync(); }