Example #1
0
        public async Task ValidateAsync(ITightsContainer tightsContainer)
        {
            if (tightsContainer == null)
            {
                throw new ArgumentNullException(nameof(tightsContainer));
            }

            var tights = await this.GetBy(tightsContainer);

            if (tightsContainer.TightsId.HasValue && tights == null)
            {
                throw new InvalidOperationException($"Tights not found by id {tightsContainer.TightsId}");
            }
        }
Example #2
0
 private Task <Tights> GetBy(ITightsContainer departmentContainer)
 {
     return(this.TightsDataAccess.GetByAsync(departmentContainer));
 }
Example #3
0
 public async Task <Tights> GetByAsync(ITightsContainer tights)
 {
     return(tights.TightsId.HasValue
         ? this.Mapper.Map <Tights>(await this.Context.Tights.FirstOrDefaultAsync(x => x.Id == tights.TightsId))
         : null);
 }