public bool UpdateDocumentType(DocumentTypeDto request) { ValidateRequireDocumentype(request); var documentTypeIdExist = _repoDocumentType .SearchMatching <DocumentTypeEntity>(dt => dt.DocumentTypeId == request.DocumentTypeId); if (!documentTypeIdExist.Any()) { throw new DontExistIdException(); } var entityUpdate = documentTypeIdExist.FirstOrDefault(); entityUpdate.DocumentType = request.DocumentType; return(_repoDocumentType.Update(entityUpdate)); }
public void ValidateDontHaveDocumentTypeNit(EmployedDto request, IEnumerable <EmployedEntity> people) { var documentIdExist = _repoDocumentType .SearchMatching <DocumentTypeEntity>(dt => dt.DocumentTypeId == request.DocumentTypeId); if (!documentIdExist.Any()) { throw new NoExistDocumentTypeException(); } var documentIsNit = documentIdExist.Where(x => x.DocumentType.ToLower() == "nit"); if (documentIsNit.Any()) { throw new CannotBeCorporatePersonException("Una persona no puede tener un tipo de documento Nit"); } }
public void ValidateDontHaveDocumentTypeDiferentNit(ProviderDto request, IEnumerable <ProviderEntity> people) { var documentIdExist = _repoDocumentType .SearchMatching <DocumentTypeEntity>(dt => dt.DocumentTypeId == request.DocumentTypeId); if (!documentIdExist.Any()) { throw new NoExistDocumentTypeException(); } var documentIsNit = documentIdExist.Where(x => x.DocumentType.ToLower() != "nit"); if (documentIsNit.Any()) { throw new CannotBeNaturalPersonException("Una persona no puede tener un tipo de documento diferente a Nit"); } }