public static string ValidateIdentification(this string value, IdentificationTypes identificationType) { if (identificationType == IdentificationTypes.Passport) { if (value.Length > 6) { return(value); } } if (value.Length == 13) { return(value); } throw new ValidationException(Messages.Val_Identification); }
public async Task <Response> FindById(int id) { IdentificationTypes result = await _identificationTypesRepository.FindById(id); if (result.Id > 0) { return(new Response { IsSuccess = true, Message = "Se consulto exitosamente", Result = result }); } else { return(new Response { IsSuccess = false, Message = "Error" }); } }
public async Task <IdentificationTypes> FindById(int id) { using (SqlConnection sql = new SqlConnection(_connectionString)) { using (SqlCommand cmd = new SqlCommand("usp_IdentificationTypes_FindById", sql)) { cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@Id", id)); IdentificationTypes response = null; await sql.OpenAsync(); using (var reader = await cmd.ExecuteReaderAsync()) { if (reader != null) { response = reader.Translate <IdentificationTypes>().FirstOrDefault(); } } return(response); } } }
public static string GetDescription(IdentificationTypes idType) { return(idType.ToStringValue()); }