Esempio n. 1
0
 private async Task CheckAttribute(List <ValidationFailure> list, EmployeeAttribute attribute)
 {
     if (!await _attributeInfoService.IsExists(attribute.AttributeInfoId))
     {
         list.Add("Attribute with same id wasn't found.");
     }
 }
 public async Task Validate(List <ValidationFailure> list, DeleteAttributeCommand request)
 {
     if (!await _attributeInfoService.IsExists(request.AttributeInfoId))
     {
         list.Add("Attribute not found.");
     }
 }
Esempio n. 3
0
        public async Task Validate(List <ValidationFailure> list, SaveAttributeCommand request)
        {
            list.NotNullOrEmpty("Name", request.Name);

            if (await _attributeInfoService.IsExists(request.Name).ConfigureAwait(false))
            {
                list.Add("Attribute with same name already exists.");
            }

            if (request.Id.HasValue)
            {
                if (!await _attributeInfoService.IsExists(request.Id.Value))
                {
                    list.Add("Attribute with same id wasn't found.");
                }
            }
        }
Esempio n. 4
0
        public async Task Validate(List <ValidationFailure> list, GetAttributeSavingInfoQuery request)
        {
            if (!request.Id.HasValue)
            {
                return;
            }

            if (!await _attributeInfoService.IsExists(request.Id.Value))
            {
                list.Add("Attribute with same id wasn't found.");
            }
        }
Esempio n. 5
0
        public async Task Validate(List <ValidationFailure> list, DeleteDocumentCommand request)
        {
            if (!await _employeeService.IsExists(request.EmployeeLogin))
            {
                list.Add("Employee not found.");
                return;
            }

            if (!await _attributeInfoService.IsExists(request.AttributeInfoId))
            {
                list.Add("Attribute not found.");
            }

            var employee = await _employeeService.GetByLogin(request.EmployeeLogin);

            var attribute = await _attributeInfoService.GetById(request.AttributeInfoId);

            if (!_documentService.IsExists(employee, attribute))
            {
                list.Add("Document not found.");
            }
        }