public async Task <int> UploadIdentification([FromBody] UserIdentificationModel userIdentificationModel) { ValidateUserIdentificationModel(userIdentificationModel); var userIdentificationEntity = _mapper.Map <UserIdentification>(userIdentificationModel); return(await _userService.SaveIdentification(userIdentificationEntity)); }
private static void ValidateUserIdentificationModel(UserIdentificationModel userIdentificationModel) { if (userIdentificationModel == null) { throw new ValidationException($"Invalid data for {nameof(userIdentificationModel)}"); } if (userIdentificationModel.UserId == default(int) || userIdentificationModel.UserId <= 0) { throw new ValidationException("Invalid UserId"); } if (string.IsNullOrEmpty(userIdentificationModel.FileExtension)) { throw new ValidationException("Invalid File Extenion"); } if (string.IsNullOrEmpty(userIdentificationModel.Base64Data)) { throw new ValidationException("Invalid Data"); } }