コード例 #1
0
 public ActionResponse Save(DocumentTypeDto obj, Guid?userId = null)
 {
     try
     {
         var valResult = new DocumentTypeValidator().Validate(obj);
         if (valResult.IsValid)
         {
             var response = _documentTypeRepository.Save(obj);
             return(response);
         }
         else
         {
             var valErrors = valResult.Errors.Select(e => e.ErrorMessage).ToArray();
             return(ActionResponse.Failure(valErrors));
         }
     }
     catch (Exception ex)
     {
         return(ActionResponse.Failure(ex.Message));
     }
 }
コード例 #2
0
 public DocumentTypesService(IUnitOfWork unitOfWork)
 {
     this.unitOfWork       = unitOfWork;
     mapper                = new MapperService();
     documentTypeValidator = new DocumentTypeValidator();
 }