public async Task<Limit> DisableLimit(string customerId, LimitType limitType, string author) { // Retrieve current limit var limit = await _limitRepository.Get(customerId, limitType); // Throw NotFound if it doesn't exist if (limit == null) throw new NotFoundException(LimitMessages.DepositLimitNotFound); // Disable limit limit.Disable(author); _limitRepository.AddOrUpdate(limit); //Log limit var log = new Log(limit); _logRepository.Add(log); return limit; }
public async Task<Limit> SetLimit(Limit limit) { // Retrieve current limit var currentDepositLimit = await _limitRepository.Get(limit.CustomerId, limit.LimitType); // Modify if it exists if (currentDepositLimit != null) { currentDepositLimit.Modify(limit.Value, limit.PeriodInDays, limit.EndDate, limit.Author); } // Create if it doesn't else { currentDepositLimit = limit; } _limitRepository.AddOrUpdate(currentDepositLimit); //Log limit var log = new Log(limit); //_logRepository.Add(log); return currentDepositLimit; }
public Log Add(Log log) { return _context.Logs.Add(log); }