public override Task <Detail> InsertAsync(Detail t) { var task = base.InsertAsync(t); var pr = new PriceHistoryRepository(); pr.InsertAsync(new PriceHistory { Date = DateTime.UtcNow, DetailId = t.Id, Price = t.Price ?? 0, Operation = Operation.Create }).Wait(); return(task); }
public override Task UpdateAsync(Detail t) { var price = GetByIdAsync(t.Id).Result.Price; var task = base.UpdateAsync(t); if (price != t.Price) { var pr = new PriceHistoryRepository(); pr.InsertAsync(new PriceHistory { Date = DateTime.UtcNow, DetailId = t.Id, Price = t.Price ?? 0, Operation = Operation.Update }).Wait(); } return(task); }